Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Plastic gun. Ingenious. More coffee, please." -- The Phantom comics


devel / comp.lang.c / Re: What is wrong with this?

SubjectAuthor
* What is wrong with this?Jack Lemmon
+* Re: What is wrong with this?Scott Lurndal
|`* Re: What is wrong with this?Bonita Montero
| `* Re: What is wrong with this?Guillaume
|  `* Re: What is wrong with this?fir
|   `- Re: What is wrong with this?Öö Tiib
+- Re: What is wrong with this?Lew Pitcher
+- Re: What is wrong with this?David Brown
+- Re: What is wrong with this?Kenny McCormack
+* Re: What is wrong with this?Andrey Tarasevich
|+* Re: What is wrong with this?David Brown
||`* Re: What is wrong with this?Malcolm McLean
|| `* Re: What is wrong with this?David Brown
||  `* Re: What is wrong with this?Malcolm McLean
||   `* Re: What is wrong with this?David Brown
||    `- Re: What is wrong with this?Malcolm McLean
|+* Re: What is wrong with this?Scott Lurndal
||+* Re: What is wrong with this?Malcolm McLean
|||+* Re: What is wrong with this?Manfred
||||`* Re: What is wrong with this?Malcolm McLean
|||| `* Re: What is wrong with this?Manfred
||||  `- Re: What is wrong with this?Kenny McCormack
|||`* Re: What is wrong with this?Andrey Tarasevich
||| `* Re: What is wrong with this?Keith Thompson
|||  `* Re: What is wrong with this?Kenny McCormack
|||   `- Re: What is wrong with this?David Brown
||`* Re: What is wrong with this?Andrey Tarasevich
|| +- Re: What is wrong with this?Manfred
|| +* Re: What is wrong with this?James Kuyper
|| |`* Re: What is wrong with this?Andrey Tarasevich
|| | +- Re: What is wrong with this?Keith Thompson
|| | +* Re: What is wrong with this?David Brown
|| | |+* Re: What is wrong with this?Andrey Tarasevich
|| | ||+* Re: What is wrong with this?fir
|| | |||`- Re: What is wrong with this?fir
|| | ||+- Re: What is wrong with this?Manfred
|| | ||`* Re: What is wrong with this?Öö Tiib
|| | || +- Re: What is wrong with this?Malcolm McLean
|| | || `* Re: What is wrong with this?Andrey Tarasevich
|| | ||  `* Re: What is wrong with this?Öö Tiib
|| | ||   `- Re: What is wrong with this?Manfred
|| | |`* Re: What is wrong with this?bart c
|| | | `- Re: What is wrong with this?David Brown
|| | +* Re: What is wrong with this?James Kuyper
|| | |`* Re: What is wrong with this?Malcolm McLean
|| | | +* Re: What is wrong with this?David Brown
|| | | |`* Re: What is wrong with this?Malcolm McLean
|| | | | `* Re: What is wrong with this?David Brown
|| | | |  `* Re: What is wrong with this?Malcolm McLean
|| | | |   `- Re: What is wrong with this?Thiago Adams
|| | | `* Re: What is wrong with this?Stef
|| | |  `- Re: What is wrong with this?James Kuyper
|| | `- Re: What is wrong with this?Malcolm McLean
|| `* Re: What is wrong with this?antispam
||  `- Re: What is wrong with this?James Kuyper
|`* Re: What is wrong with this?James Kuyper
| `- Re: What is wrong with this?Malcolm McLean
+* Re: What is wrong with this?Sams Lara
|`- Re: What is wrong with this?Thiago Adams
+- Re: What is wrong with this?bart c
`- Re: What is wrong with this?Paul

Pages:123
What is wrong with this?

<t3k4n3$1ba2l$1@paganini.bofh.team>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21264&group=comp.lang.c#21264

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!not-for-mail
From: inva...@invalid.net (Jack Lemmon)
Newsgroups: comp.lang.c
Subject: What is wrong with this?
Date: Mon, 18 Apr 2022 17:44:25 +0100
Organization: To protect and to server
Message-ID: <t3k4n3$1ba2l$1@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 18 Apr 2022 16:47:31 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="1419349"; posting-host="xWoSobfAAAMkUmDG6ndrsw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team";
X-Notice: Filtered by postfilter v. 0.9.1
Content-Language: en-US
 by: Jack Lemmon - Mon, 18 Apr 2022 16:44 UTC

char get_char(const char *format, ...) __attribute__((format(printf, 1,
2)));

I downloaded a free library file from this link:
<https://github.com/cs50/libcs50/releases>

But when I try to compile it, it faults at line 58 and other lines
containing attribute world. So what exactly is likely to be wrong with it.?
The library was created by Harvard uni for students to learn C
programming so it must work on a Windows system using visual Studio, but
it doesn't. What changes should I make to make it work?

Re: What is wrong with this?

<7Pg7K.247579$H_t7.25381@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21265&group=comp.lang.c#21265

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx40.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: What is wrong with this?
Newsgroups: comp.lang.c
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Lines: 21
Message-ID: <7Pg7K.247579$H_t7.25381@fx40.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 18 Apr 2022 17:00:51 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 18 Apr 2022 17:00:51 GMT
X-Received-Bytes: 1348
 by: Scott Lurndal - Mon, 18 Apr 2022 17:00 UTC

Jack Lemmon <invalid@invalid.net> writes:
>
>char get_char(const char *format, ...) __attribute__((format(printf, 1,
>2)));
>
>I downloaded a free library file from this link:
><https://github.com/cs50/libcs50/releases>
>
>But when I try to compile it, it faults at line 58 and other lines
>containing attribute world. So what exactly is likely to be wrong with it.?
>The library was created by Harvard uni for students to learn C
>programming so it must work on a Windows system using visual Studio, but

Evidence doesn't support the conclusion.

>it doesn't. What changes should I make to make it work?

Don't use Microsoft compilers.

__attribute__ is a GCC extension.

Re: What is wrong with this?

<t3k5n0$rk0$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21266&group=comp.lang.c#21266

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Mon, 18 Apr 2022 17:04:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <t3k5n0$rk0$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 18 Apr 2022 17:04:32 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="dec26c811703e40e45b70d56344c454e";
logging-data="28288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wntHSmKBe0zIBJ+Vc0OPp+CK9Tw774P4="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:X1oCTvoa7Pw/7HOGLKtwn/KPsic=
 by: Lew Pitcher - Mon, 18 Apr 2022 17:04 UTC

On Mon, 18 Apr 2022 17:44:25 +0100, Jack Lemmon wrote:

> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> 2)));

__attribute__ isn't a standard C keyword (or even a standard C anything).
It is, however, an extension to the C language implemented in the GNU C
compiler.

> I downloaded a free library file from this link:
> <https://github.com/cs50/libcs50/releases>
>
> But when I try to compile it, it faults at line 58 and other lines
> containing attribute world. So what exactly is likely to be wrong with it.?
> The library was created by Harvard uni for students to learn C
> programming so it must work

Yah, faulty assumption there...

> on a Windows system using visual Studio, but

The Microsoft Visual Studio does not support the GCC __attribute__ extension
to the C language. To properly compile libcs50, you will need a GNU C compiler.

> it doesn't. What changes should I make to make it work?

HTH
--
Lew Pitcher
"In Skills, We Trust"

Re: What is wrong with this?

<t3k6s4$kr2$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21268&group=comp.lang.c#21268

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Mon, 18 Apr 2022 19:24:19 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <t3k6s4$kr2$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 18 Apr 2022 17:24:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="35eb9afadf5b2d8b092ff642766740f8";
logging-data="21346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2sBfEfYttIeQYpfnsJ4hfi765IzgzTho="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:5CNl82kI8KDHCsteZnbJmUKDH3E=
In-Reply-To: <t3k4n3$1ba2l$1@paganini.bofh.team>
Content-Language: en-GB
 by: David Brown - Mon, 18 Apr 2022 17:24 UTC

On 18/04/2022 18:44, Jack Lemmon wrote:
>
> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> 2)));
>
> I downloaded a free library file from this link:
> <https://github.com/cs50/libcs50/releases>
>
> But when I try to compile it, it faults at line 58 and other lines
> containing attribute world. So what exactly is likely to be wrong with it.?
> The library was created by Harvard uni for students to learn C
> programming so it must work on a Windows system using visual Studio, but
> it doesn't. What changes should I make to make it work?
>

Windows and Visual Studio are very questionable choices for learning C -
MSVC has a good reputation for C++ AFAIK, but much poorer for C as it is
simply not a commonly used language for Windows programming.

The __attribute__ syntax is a gcc extension, not standard C. It is
supported by a number of other C compilers, including clang and icc, but
not by Microsoft's tools. (Some of there tools are designed to work
with third-party compilers such as clang and gcc, but I have no
experience with them - maybe their IDE will still complain about such
extensions.)

Re: What is wrong with this?

<t3kp00$33o32$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21271&group=comp.lang.c#21271

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Mon, 18 Apr 2022 22:33:36 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <t3kp00$33o32$1@news.xmission.com>
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Injection-Date: Mon, 18 Apr 2022 22:33:36 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3268706"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Mon, 18 Apr 2022 22:33 UTC

In article <t3k4n3$1ba2l$1@paganini.bofh.team>,
Jack Lemmon <invalid@invalid.net> wrote:
>
>char get_char(const char *format, ...) __attribute__((format(printf, 1,
>2)));
>
>I downloaded a free library file from this link:
><https://github.com/cs50/libcs50/releases>
>
>But when I try to compile it, it faults at line 58 and other lines
>containing attribute world. So what exactly is likely to be wrong with it.?
>The library was created by Harvard uni for students to learn C
>programming so it must work on a Windows system using visual Studio, but
>it doesn't. What changes should I make to make it work?

The real answer to your query is: Ask your instructor which compiler you are
supposed to be using (for whatever platform you are supposed to be using).

--
A Catholic woman tells her husband to buy Viagra.

A Jewish woman tells her husband to buy Pfizer.

Re: What is wrong with this?

<t3kvua$5p1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21273&group=comp.lang.c#21273

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: andreyta...@hotmail.com (Andrey Tarasevich)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Mon, 18 Apr 2022 17:32:09 -0700
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <t3kvua$5p1$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 00:32:10 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="198bf494fe46d49632b031e1794eea92";
logging-data="5921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188L+wKK3cHsC1R4vM5JdKX"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Cancel-Lock: sha1:GjqdPTKEFOVHYQQX8eQ+QqZnod0=
In-Reply-To: <t3k4n3$1ba2l$1@paganini.bofh.team>
Content-Language: en-US
 by: Andrey Tarasevich - Tue, 19 Apr 2022 00:32 UTC

On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>
> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> 2)));
>
> I downloaded a free library file from this link:
> <https://github.com/cs50/libcs50/releases>
>
> But when I try to compile it, it faults at line 58 and other lines
> containing attribute world. So what exactly is likely to be wrong with it.?
> The library was created by Harvard uni for students to learn C
> programming so it must work on a Windows system using visual Studio, but
> it doesn't. What changes should I make to make it work?

It is low quality code apparently originating from some educational
institution in USA. Harvard, you said? Avoid code with such questionable
origins - it is usually garbage. The code you quoted is written
exclusively for GCC and apparently exclusively for the internal
educational purposes. It uses some motley non-standard GCC extensions.
And no effort was made to make it transparently portable to other
compilers, including especially Visual Studio.

When code does not compile in Visual Studio it is effectively useless.
Compatibility with Visual Studio is a hard requirement for all C and C++
code in professional world.

--
Best regards,
Andrey Tarasevich

Re: What is wrong with this?

<t3lptp$ocl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21275&group=comp.lang.c#21275

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 09:55:36 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <t3lptp$ocl$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 07:55:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="947622157c3f18b5c9ab7c38071a6362";
logging-data="24981"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uBYZXYFbVDVPhtZRQu1vWkNZiGU24ado="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:XDH5iF36VUdYNdK8fp1HO8Ebvp0=
In-Reply-To: <t3kvua$5p1$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Tue, 19 Apr 2022 07:55 UTC

On 19/04/2022 02:32, Andrey Tarasevich wrote:
> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>
>> char get_char(const char *format, ...) __attribute__((format(printf, 1,
>> 2)));
>>
>> I downloaded a free library file from this link:
>> <https://github.com/cs50/libcs50/releases>
>>
>> But when I try to compile it, it faults at line 58 and other lines
>> containing attribute world. So what exactly is likely to be wrong with
>> it.?
>> The library was created by Harvard uni for students to learn C
>> programming so it must work on a Windows system using visual Studio, but
>> it doesn't. What changes should I make to make it work?
>
> It is low quality code apparently originating from some educational
> institution in USA. Harvard, you said? Avoid code with such questionable
> origins - it is usually garbage. The code you quoted is written
> exclusively for GCC and apparently exclusively for the internal
> educational purposes. It uses some motley non-standard GCC extensions.
> And no effort was made to make it transparently portable to other
> compilers, including especially Visual Studio.
>
> When code does not compile in Visual Studio it is effectively useless.
> Compatibility with Visual Studio is a hard requirement for all C and C++
> code in professional world.
>

I assume that last paragraph is sarcasm. But given the original
question, the OP might not understand that.

Some code is written to be widely portable. Other code is not. That is
fine, and entirely appropriate use of the languages and tools.
Pointlessly non-portable code is a bad habit - but so is pointlessly
portable code.

C is rarely used for Windows programming, and MSVC is rarely used for C
on Windows. Therefore it usually makes little sense to go out of your
way to worry about making your C code compatible with MS tools.

(I haven't bothered to look at the code in question, and can't comment
on its purpose or quality.)

Re: What is wrong with this?

<f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21277&group=comp.lang.c#21277

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:9ad5:0:b0:69e:8c03:7e0 with SMTP id c204-20020a379ad5000000b0069e8c0307e0mr5939128qke.747.1650360770420;
Tue, 19 Apr 2022 02:32:50 -0700 (PDT)
X-Received: by 2002:ad4:5be1:0:b0:430:c99:8a87 with SMTP id
k1-20020ad45be1000000b004300c998a87mr10761997qvc.82.1650360770171; Tue, 19
Apr 2022 02:32:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 02:32:49 -0700 (PDT)
In-Reply-To: <t3lptp$ocl$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me> <t3lptp$ocl$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 09:32:50 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 46
 by: Malcolm McLean - Tue, 19 Apr 2022 09:32 UTC

On Tuesday, 19 April 2022 at 08:55:50 UTC+1, David Brown wrote:
> On 19/04/2022 02:32, Andrey Tarasevich wrote:
> > On 4/18/2022 9:44 AM, Jack Lemmon wrote:
> >>
> >> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> >> 2)));
> >>
> >> I downloaded a free library file from this link:
> >> <https://github.com/cs50/libcs50/releases>
> >>
> >> But when I try to compile it, it faults at line 58 and other lines
> >> containing attribute world. So what exactly is likely to be wrong with
> >> it.?
> >> The library was created by Harvard uni for students to learn C
> >> programming so it must work on a Windows system using visual Studio, but
> >> it doesn't. What changes should I make to make it work?
> >
> > It is low quality code apparently originating from some educational
> > institution in USA. Harvard, you said? Avoid code with such questionable
> > origins - it is usually garbage. The code you quoted is written
> > exclusively for GCC and apparently exclusively for the internal
> > educational purposes. It uses some motley non-standard GCC extensions.
> > And no effort was made to make it transparently portable to other
> > compilers, including especially Visual Studio.
> >
> > When code does not compile in Visual Studio it is effectively useless.
> > Compatibility with Visual Studio is a hard requirement for all C and C++
> > code in professional world.
> >
> I assume that last paragraph is sarcasm. But given the original
> question, the OP might not understand that.
>
> Some code is written to be widely portable. Other code is not. That is
> fine, and entirely appropriate use of the languages and tools.
> Pointlessly non-portable code is a bad habit - but so is pointlessly
> portable code.
>
You make it sound as if it's a mirror image.

You can make code too portable, for instance by passing in function pointers
to break the dependency on IO, when in fact there is a soft dependency there
anyway because the the function makes certain assumptions about the
operations available via the IO, and when it would be far clearer to simply
call IO directly. But I've rarely seen this.

Code that should be portable but has some dependency somewhere which
could have been easily refactored out, you see all of the time.

Re: What is wrong with this?

<t3m4dl$1nr$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21278&group=comp.lang.c#21278

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 12:54:44 +0200
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <t3m4dl$1nr$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<t3lptp$ocl$1@dont-email.me>
<f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 10:54:45 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="947622157c3f18b5c9ab7c38071a6362";
logging-data="1787"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/e8beGjvTmQXSHiPKx9NtIBrwO/UvmKzA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:ITi4Tv8dU68sfsu+6poAI1BVsqk=
In-Reply-To: <f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Tue, 19 Apr 2022 10:54 UTC

On 19/04/2022 11:32, Malcolm McLean wrote:
> On Tuesday, 19 April 2022 at 08:55:50 UTC+1, David Brown wrote:
>> On 19/04/2022 02:32, Andrey Tarasevich wrote:
>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>>>
>>>> char get_char(const char *format, ...) __attribute__((format(printf, 1,
>>>> 2)));
>>>>
>>>> I downloaded a free library file from this link:
>>>> <https://github.com/cs50/libcs50/releases>
>>>>
>>>> But when I try to compile it, it faults at line 58 and other lines
>>>> containing attribute world. So what exactly is likely to be wrong with
>>>> it.?
>>>> The library was created by Harvard uni for students to learn C
>>>> programming so it must work on a Windows system using visual Studio, but
>>>> it doesn't. What changes should I make to make it work?
>>>
>>> It is low quality code apparently originating from some educational
>>> institution in USA. Harvard, you said? Avoid code with such questionable
>>> origins - it is usually garbage. The code you quoted is written
>>> exclusively for GCC and apparently exclusively for the internal
>>> educational purposes. It uses some motley non-standard GCC extensions.
>>> And no effort was made to make it transparently portable to other
>>> compilers, including especially Visual Studio.
>>>
>>> When code does not compile in Visual Studio it is effectively useless.
>>> Compatibility with Visual Studio is a hard requirement for all C and C++
>>> code in professional world.
>>>
>> I assume that last paragraph is sarcasm. But given the original
>> question, the OP might not understand that.
>>
>> Some code is written to be widely portable. Other code is not. That is
>> fine, and entirely appropriate use of the languages and tools.
>> Pointlessly non-portable code is a bad habit - but so is pointlessly
>> portable code.
>>
> You make it sound as if it's a mirror image.
>
> You can make code too portable, for instance by passing in function pointers
> to break the dependency on IO, when in fact there is a soft dependency there
> anyway because the the function makes certain assumptions about the
> operations available via the IO, and when it would be far clearer to simply
> call IO directly. But I've rarely seen this.
>
> Code that should be portable but has some dependency somewhere which
> could have been easily refactored out, you see all of the time.

I'm sorry, I have /no/ idea why you are talking about function pointers
and "soft dependencies" (whatever that might mean).

A lot of code has parts that are easily portable to a fairly wide range
of targets (processor, compiler, OS) and also parts that are much more
dependent on aspects of the target. If you are writing a program that
is targeting Windows only, and aimed for MSVC, then it makes sense to
accept that non-portability if it lets you use extra non-portable
features that improve your code in some way. The same applies if you
are targeting gcc and POSIX, or an embedded system, or anything else.
Most real-world practical code does not need to be particularly portable.

It can often be practical to have a compatibility layer - a header that
has conditional compilation and defines macros or other features, so
that code can be compiled on different toolchains.

It is usually hard to predict where your code might end up in the
future, so reasonable portability is a good thing. But there is no
point in writing code in a way that is unrealistically portable.

Re: What is wrong with this?

<2cc7a891-5700-4f3e-99a1-3dc05e19c702n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21279&group=comp.lang.c#21279

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:46:b0:2f2:9b12:5375 with SMTP id y6-20020a05622a004600b002f29b125375mr3057252qtw.625.1650367915354;
Tue, 19 Apr 2022 04:31:55 -0700 (PDT)
X-Received: by 2002:a05:620a:20c2:b0:69e:6ef0:7aaf with SMTP id
f2-20020a05620a20c200b0069e6ef07aafmr9122127qka.187.1650367915078; Tue, 19
Apr 2022 04:31:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 04:31:54 -0700 (PDT)
In-Reply-To: <t3m4dl$1nr$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<t3lptp$ocl$1@dont-email.me> <f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
<t3m4dl$1nr$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2cc7a891-5700-4f3e-99a1-3dc05e19c702n@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 11:31:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 60
 by: Malcolm McLean - Tue, 19 Apr 2022 11:31 UTC

On Tuesday, 19 April 2022 at 11:54:59 UTC+1, David Brown wrote:
> On 19/04/2022 11:32, Malcolm McLean wrote:
> > On Tuesday, 19 April 2022 at 08:55:50 UTC+1, David Brown wrote:
> >> On 19/04/2022 02:32, Andrey Tarasevich wrote:
> >>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
> >>>>
> >>>> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> >>>> 2)));
> >>>>
> >>>> I downloaded a free library file from this link:
> >>>> <https://github.com/cs50/libcs50/releases>
> >>>>
> >>>> But when I try to compile it, it faults at line 58 and other lines
> >>>> containing attribute world. So what exactly is likely to be wrong with
> >>>> it.?
> >>>> The library was created by Harvard uni for students to learn C
> >>>> programming so it must work on a Windows system using visual Studio, but
> >>>> it doesn't. What changes should I make to make it work?
> >>>
> >>> It is low quality code apparently originating from some educational
> >>> institution in USA. Harvard, you said? Avoid code with such questionable
> >>> origins - it is usually garbage. The code you quoted is written
> >>> exclusively for GCC and apparently exclusively for the internal
> >>> educational purposes. It uses some motley non-standard GCC extensions.
> >>> And no effort was made to make it transparently portable to other
> >>> compilers, including especially Visual Studio.
> >>>
> >>> When code does not compile in Visual Studio it is effectively useless.
> >>> Compatibility with Visual Studio is a hard requirement for all C and C++
> >>> code in professional world.
> >>>
> >> I assume that last paragraph is sarcasm. But given the original
> >> question, the OP might not understand that.
> >>
> >> Some code is written to be widely portable. Other code is not. That is
> >> fine, and entirely appropriate use of the languages and tools.
> >> Pointlessly non-portable code is a bad habit - but so is pointlessly
> >> portable code.
> >>
> > You make it sound as if it's a mirror image.
> >
> > You can make code too portable, for instance by passing in function pointers
> > to break the dependency on IO, when in fact there is a soft dependency there
> > anyway because the the function makes certain assumptions about the
> > operations available via the IO, and when it would be far clearer to simply
> > call IO directly. But I've rarely seen this.
> >
> > Code that should be portable but has some dependency somewhere which
> > could have been easily refactored out, you see all of the time.
> I'm sorry, I have /no/ idea why you are talking about function pointers
> and "soft dependencies" (whatever that might mean).
>
Function pointers are an important tool for removing problem- or platform-
specific code from the main logical core of the application. A hard dependency
is when A makes a direct reference to B, in the simplest case, because A
calls B. We can remove the dependency by adding a layer of indirection, so we
can now replace B with C, D, E etc. However it's a "soft dependency" if it turns
out that the characteristics required of C, D, E etc are so narrow, that to all
intents and purposes, they are required to be B, and in reality the system will
need reengineering if B is not avaliable.

Re: What is wrong with this?

<t3m7od$pkb$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21280&group=comp.lang.c#21280

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 13:51:40 +0200
Organization: A noiseless patient Spider
Lines: 67
Message-ID: <t3m7od$pkb$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<t3lptp$ocl$1@dont-email.me>
<f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
<t3m4dl$1nr$1@dont-email.me>
<2cc7a891-5700-4f3e-99a1-3dc05e19c702n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 11:51:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="947622157c3f18b5c9ab7c38071a6362";
logging-data="26251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183jf7J9lEFr/6590HcF4JWpymYa1jIM8U="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:v5unuCKB39jHgoJ/H/G3bVF0aQo=
In-Reply-To: <2cc7a891-5700-4f3e-99a1-3dc05e19c702n@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Tue, 19 Apr 2022 11:51 UTC

On 19/04/2022 13:31, Malcolm McLean wrote:
> On Tuesday, 19 April 2022 at 11:54:59 UTC+1, David Brown wrote:
>> On 19/04/2022 11:32, Malcolm McLean wrote:
>>> On Tuesday, 19 April 2022 at 08:55:50 UTC+1, David Brown wrote:
>>>> On 19/04/2022 02:32, Andrey Tarasevich wrote:
>>>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>>>>>
>>>>>> char get_char(const char *format, ...) __attribute__((format(printf, 1,
>>>>>> 2)));
>>>>>>
>>>>>> I downloaded a free library file from this link:
>>>>>> <https://github.com/cs50/libcs50/releases>
>>>>>>
>>>>>> But when I try to compile it, it faults at line 58 and other lines
>>>>>> containing attribute world. So what exactly is likely to be wrong with
>>>>>> it.?
>>>>>> The library was created by Harvard uni for students to learn C
>>>>>> programming so it must work on a Windows system using visual Studio, but
>>>>>> it doesn't. What changes should I make to make it work?
>>>>>
>>>>> It is low quality code apparently originating from some educational
>>>>> institution in USA. Harvard, you said? Avoid code with such questionable
>>>>> origins - it is usually garbage. The code you quoted is written
>>>>> exclusively for GCC and apparently exclusively for the internal
>>>>> educational purposes. It uses some motley non-standard GCC extensions.
>>>>> And no effort was made to make it transparently portable to other
>>>>> compilers, including especially Visual Studio.
>>>>>
>>>>> When code does not compile in Visual Studio it is effectively useless.
>>>>> Compatibility with Visual Studio is a hard requirement for all C and C++
>>>>> code in professional world.
>>>>>
>>>> I assume that last paragraph is sarcasm. But given the original
>>>> question, the OP might not understand that.
>>>>
>>>> Some code is written to be widely portable. Other code is not. That is
>>>> fine, and entirely appropriate use of the languages and tools.
>>>> Pointlessly non-portable code is a bad habit - but so is pointlessly
>>>> portable code.
>>>>
>>> You make it sound as if it's a mirror image.
>>>
>>> You can make code too portable, for instance by passing in function pointers
>>> to break the dependency on IO, when in fact there is a soft dependency there
>>> anyway because the the function makes certain assumptions about the
>>> operations available via the IO, and when it would be far clearer to simply
>>> call IO directly. But I've rarely seen this.
>>>
>>> Code that should be portable but has some dependency somewhere which
>>> could have been easily refactored out, you see all of the time.
>> I'm sorry, I have /no/ idea why you are talking about function pointers
>> and "soft dependencies" (whatever that might mean).
>>
> Function pointers are an important tool for removing problem- or platform-
> specific code from the main logical core of the application. A hard dependency
> is when A makes a direct reference to B, in the simplest case, because A
> calls B. We can remove the dependency by adding a layer of indirection, so we
> can now replace B with C, D, E etc. However it's a "soft dependency" if it turns
> out that the characteristics required of C, D, E etc are so narrow, that to all
> intents and purposes, they are required to be B, and in reality the system will
> need reengineering if B is not avaliable.
>

Okay, so as I thought the term "soft dependency" is your own personal
and subjective term, and like function pointers it is not relevant to
the discussion or of any help to the OP. So let's leave it there.

Re: What is wrong with this?

<d51f813e-3f76-4402-8494-460473f0ec03n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21281&group=comp.lang.c#21281

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a0c:8e0b:0:b0:435:1779:7b22 with SMTP id v11-20020a0c8e0b000000b0043517797b22mr11272921qvb.63.1650371591043;
Tue, 19 Apr 2022 05:33:11 -0700 (PDT)
X-Received: by 2002:a05:6214:2a82:b0:443:e2fc:c209 with SMTP id
jr2-20020a0562142a8200b00443e2fcc209mr10970063qvb.59.1650371590819; Tue, 19
Apr 2022 05:33:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 05:33:10 -0700 (PDT)
In-Reply-To: <t3m7od$pkb$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<t3lptp$ocl$1@dont-email.me> <f99e287b-d783-4ee3-976d-a607edeaea94n@googlegroups.com>
<t3m4dl$1nr$1@dont-email.me> <2cc7a891-5700-4f3e-99a1-3dc05e19c702n@googlegroups.com>
<t3m7od$pkb$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d51f813e-3f76-4402-8494-460473f0ec03n@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 12:33:11 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 70
 by: Malcolm McLean - Tue, 19 Apr 2022 12:33 UTC

On Tuesday, 19 April 2022 at 12:51:54 UTC+1, David Brown wrote:
> On 19/04/2022 13:31, Malcolm McLean wrote:
> > On Tuesday, 19 April 2022 at 11:54:59 UTC+1, David Brown wrote:
> >> On 19/04/2022 11:32, Malcolm McLean wrote:
> >>> On Tuesday, 19 April 2022 at 08:55:50 UTC+1, David Brown wrote:
> >>>> On 19/04/2022 02:32, Andrey Tarasevich wrote:
> >>>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
> >>>>>>
> >>>>>> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> >>>>>> 2)));
> >>>>>>
> >>>>>> I downloaded a free library file from this link:
> >>>>>> <https://github.com/cs50/libcs50/releases>
> >>>>>>
> >>>>>> But when I try to compile it, it faults at line 58 and other lines
> >>>>>> containing attribute world. So what exactly is likely to be wrong with
> >>>>>> it.?
> >>>>>> The library was created by Harvard uni for students to learn C
> >>>>>> programming so it must work on a Windows system using visual Studio, but
> >>>>>> it doesn't. What changes should I make to make it work?
> >>>>>
> >>>>> It is low quality code apparently originating from some educational
> >>>>> institution in USA. Harvard, you said? Avoid code with such questionable
> >>>>> origins - it is usually garbage. The code you quoted is written
> >>>>> exclusively for GCC and apparently exclusively for the internal
> >>>>> educational purposes. It uses some motley non-standard GCC extensions.
> >>>>> And no effort was made to make it transparently portable to other
> >>>>> compilers, including especially Visual Studio.
> >>>>>
> >>>>> When code does not compile in Visual Studio it is effectively useless.
> >>>>> Compatibility with Visual Studio is a hard requirement for all C and C++
> >>>>> code in professional world.
> >>>>>
> >>>> I assume that last paragraph is sarcasm. But given the original
> >>>> question, the OP might not understand that.
> >>>>
> >>>> Some code is written to be widely portable. Other code is not. That is
> >>>> fine, and entirely appropriate use of the languages and tools.
> >>>> Pointlessly non-portable code is a bad habit - but so is pointlessly
> >>>> portable code.
> >>>>
> >>> You make it sound as if it's a mirror image.
> >>>
> >>> You can make code too portable, for instance by passing in function pointers
> >>> to break the dependency on IO, when in fact there is a soft dependency there
> >>> anyway because the the function makes certain assumptions about the
> >>> operations available via the IO, and when it would be far clearer to simply
> >>> call IO directly. But I've rarely seen this.
> >>>
> >>> Code that should be portable but has some dependency somewhere which
> >>> could have been easily refactored out, you see all of the time.
> >> I'm sorry, I have /no/ idea why you are talking about function pointers
> >> and "soft dependencies" (whatever that might mean).
> >>
> > Function pointers are an important tool for removing problem- or platform-
> > specific code from the main logical core of the application. A hard dependency
> > is when A makes a direct reference to B, in the simplest case, because A
> > calls B. We can remove the dependency by adding a layer of indirection, so we
> > can now replace B with C, D, E etc. However it's a "soft dependency" if it turns
> > out that the characteristics required of C, D, E etc are so narrow, that to all
> > intents and purposes, they are required to be B, and in reality the system will
> > need reengineering if B is not avaliable.
> >
> Okay, so as I thought the term "soft dependency" is your own personal
> and subjective term, and like function pointers it is not relevant to
> the discussion or of any help to the OP. So let's leave it there.
>
As far as I'm aware I'm the first person to use the term "soft dependency",
though I doubt the issue has not been identified by many other people before.
The words "hard" and "soft" have fairly well accepted meanings, and I was
not using the term in a "subjective" way.

Re: What is wrong with this?

<Hmz7K.73578$e%.2483@fx36.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21282&group=comp.lang.c#21282

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx36.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: What is wrong with this?
Newsgroups: comp.lang.c
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
Lines: 10
Message-ID: <Hmz7K.73578$e%.2483@fx36.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 19 Apr 2022 14:07:35 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 19 Apr 2022 14:07:35 GMT
X-Received-Bytes: 1166
 by: Scott Lurndal - Tue, 19 Apr 2022 14:07 UTC

Andrey Tarasevich <andreytarasevich@hotmail.com> writes:
>On 4/18/2022 9:44 AM, Jack Lemmon wrote:

>When code does not compile in Visual Studio it is effectively useless.
>Compatibility with Visual Studio is a hard requirement for all C and C++
>code in professional world.

Now that's funny. I've been programming "in the professional world",
in C and C++ for forty years, and Visual Studio has _never_ been part
of that process. It's been considered a toy compiler by most.

Re: What is wrong with this?

<c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21283&group=comp.lang.c#21283

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:2683:b0:69c:8c9c:5f80 with SMTP id c3-20020a05620a268300b0069c8c9c5f80mr9968136qkp.367.1650379413534;
Tue, 19 Apr 2022 07:43:33 -0700 (PDT)
X-Received: by 2002:a05:622a:60f:b0:2e2:750:ce24 with SMTP id
z15-20020a05622a060f00b002e20750ce24mr10764164qta.315.1650379413325; Tue, 19
Apr 2022 07:43:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 07:43:33 -0700 (PDT)
In-Reply-To: <Hmz7K.73578$e%.2483@fx36.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me> <Hmz7K.73578$e%.2483@fx36.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 14:43:33 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: Malcolm McLean - Tue, 19 Apr 2022 14:43 UTC

On Tuesday, 19 April 2022 at 15:07:48 UTC+1, Scott Lurndal wrote:
> Andrey Tarasevich <andreyta...@hotmail.com> writes:
> >On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>
> >When code does not compile in Visual Studio it is effectively useless.
> >Compatibility with Visual Studio is a hard requirement for all C and C++
> >code in professional world.
> Now that's funny. I've been programming "in the professional world",
> in C and C++ for forty years, and Visual Studio has _never_ been part
> of that process. It's been considered a toy compiler by most.
>
It's not a good C compiler. But it's the most realistic option for compiling
Windows programs, and there are often good reasons for writing programs
to run on Windows.
If you stick to a conservative subset of C89, you should be OK. So MSVC
is a reason for sticking to that conservative subset.

Re: What is wrong with this?

<t3ml4e$1s7g$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21285&group=comp.lang.c#21285

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 17:39:58 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t3ml4e$1s7g$1@gioia.aioe.org>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad>
<c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="61680"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Manfred - Tue, 19 Apr 2022 15:39 UTC

On 4/19/2022 4:43 PM, Malcolm McLean wrote:
> On Tuesday, 19 April 2022 at 15:07:48 UTC+1, Scott Lurndal wrote:
>> Andrey Tarasevich <andreyta...@hotmail.com> writes:
>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>
>>> When code does not compile in Visual Studio it is effectively useless.
>>> Compatibility with Visual Studio is a hard requirement for all C and C++
>>> code in professional world.
>> Now that's funny. I've been programming "in the professional world",
>> in C and C++ for forty years, and Visual Studio has _never_ been part
>> of that process. It's been considered a toy compiler by most.
>>
> It's not a good C compiler. But it's the most realistic option for compiling
> Windows programs, and there are often good reasons for writing programs
> to run on Windows.
> If you stick to a conservative subset of C89, you should be OK. So MSVC
> is a reason for sticking to that conservative subset.

I'd even say that /if/ you need to target Windows, it's probably the
best compiler for the job, in the sense that the benefit of platform
compatibility wins over the cost of lower standard compliance.

However, the main fact is that MSVC is primarily designed as a C++
compiler, and even if, as you say, there are good reason to write
programs for Windows, most often these are C++ programs, rather than C.

Re: What is wrong with this?

<t3mlip$5t6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21286&group=comp.lang.c#21286

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 11:47:36 -0400
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <t3mlip$5t6$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 15:47:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1431d2ee6fc5d1babb09c90df67e12a2";
logging-data="6054"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nFqfpU+sVUFfv9HUYgMIz5gBGZhC0NVc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Cancel-Lock: sha1:jSiVnxt1tMJQkUb6whgaHqcSlUw=
In-Reply-To: <t3kvua$5p1$1@dont-email.me>
Content-Language: en-US
 by: James Kuyper - Tue, 19 Apr 2022 15:47 UTC

On 4/18/22 20:32, Andrey Tarasevich wrote:
....
> When code does not compile in Visual Studio it is effectively useless.
> Compatibility with Visual Studio is a hard requirement for all C and
> C++ code in professional world.

I've spent a quarter century as a professional computer programmer
working on projects where compatibility with Visual Studios was not a
requirement, or even a priority. Our code was required to conform to the
C standard. We were allowed to assume POSIX conformance (though we made
little use of that fact other than the fact that our build scripts were
intended for POSIX sh, and our make files were intended for the POSIX
make utility). We were otherwise prohibited from writing
platform-specific code (not even if protected by #if* directives based
upon platform-specific macros) - that includes depending upon gcc
extensions.

Re: What is wrong with this?

<70902f4e-b4ef-4dc0-bd3d-0f64381da943n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21287&group=comp.lang.c#21287

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:107:b0:2e1:d655:cc4c with SMTP id u7-20020a05622a010700b002e1d655cc4cmr10905418qtw.669.1650383334044;
Tue, 19 Apr 2022 08:48:54 -0700 (PDT)
X-Received: by 2002:ac8:5851:0:b0:2e1:eba3:3beb with SMTP id
h17-20020ac85851000000b002e1eba33bebmr10793049qth.20.1650383333846; Tue, 19
Apr 2022 08:48:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 08:48:53 -0700 (PDT)
In-Reply-To: <t3ml4e$1s7g$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad> <c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
<t3ml4e$1s7g$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <70902f4e-b4ef-4dc0-bd3d-0f64381da943n@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 15:48:54 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 34
 by: Malcolm McLean - Tue, 19 Apr 2022 15:48 UTC

On Tuesday, 19 April 2022 at 16:40:11 UTC+1, Manfred wrote:
> On 4/19/2022 4:43 PM, Malcolm McLean wrote:
> > On Tuesday, 19 April 2022 at 15:07:48 UTC+1, Scott Lurndal wrote:
> >> Andrey Tarasevich <andreyta...@hotmail.com> writes:
> >>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
> >>
> >>> When code does not compile in Visual Studio it is effectively useless.
> >>> Compatibility with Visual Studio is a hard requirement for all C and C++
> >>> code in professional world.
> >> Now that's funny. I've been programming "in the professional world",
> >> in C and C++ for forty years, and Visual Studio has _never_ been part
> >> of that process. It's been considered a toy compiler by most.
> >>
> > It's not a good C compiler. But it's the most realistic option for compiling
> > Windows programs, and there are often good reasons for writing programs
> > to run on Windows.
> > If you stick to a conservative subset of C89, you should be OK. So MSVC
> > is a reason for sticking to that conservative subset.
> I'd even say that /if/ you need to target Windows, it's probably the
> best compiler for the job, in the sense that the benefit of platform
> compatibility wins over the cost of lower standard compliance.
>
> However, the main fact is that MSVC is primarily designed as a C++
> compiler, and even if, as you say, there are good reason to write
> programs for Windows, most often these are C++ programs, rather than C.
>
If you know that the program will be targetted at Windows, and never
run on any other platform, then generally you should go for C++ or C sharp,
because of better compiler support.
But if you are writing a general purpose routine, it will be easier to integrate
with other code if it is in C. It can be given C++, C sharp, Objective C, or
Python bindings quite easily. But it does need to compile under Visual C.
So you should be quite conservative in your choice of C constructs. MSVC
is now a lot better and, for example, supports the fixed width types, so
"a conservative subset of C89" is maybe too restrictive.

Re: What is wrong with this?

<a30a06e0-fad9-4035-af81-0737508c8505n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21288&group=comp.lang.c#21288

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:d42:b0:441:831b:fa1b with SMTP id 2-20020a0562140d4200b00441831bfa1bmr11629076qvr.130.1650383790721;
Tue, 19 Apr 2022 08:56:30 -0700 (PDT)
X-Received: by 2002:a05:622a:9:b0:2f1:e9d7:d734 with SMTP id
x9-20020a05622a000900b002f1e9d7d734mr10958887qtw.476.1650383790561; Tue, 19
Apr 2022 08:56:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!3.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 08:56:30 -0700 (PDT)
In-Reply-To: <t3mlip$5t6$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:958a:6bbd:f6f6:f35;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:958a:6bbd:f6f6:f35
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me> <t3mlip$5t6$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a30a06e0-fad9-4035-af81-0737508c8505n@googlegroups.com>
Subject: Re: What is wrong with this?
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Tue, 19 Apr 2022 15:56:30 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: Malcolm McLean - Tue, 19 Apr 2022 15:56 UTC

On Tuesday, 19 April 2022 at 16:47:49 UTC+1, james...@alumni.caltech.edu wrote:
> On 4/18/22 20:32, Andrey Tarasevich wrote:
> ...
> > When code does not compile in Visual Studio it is effectively useless.
> > Compatibility with Visual Studio is a hard requirement for all C and
> > C++ code in professional world.
> I've spent a quarter century as a professional computer programmer
> working on projects where compatibility with Visual Studios was not a
> requirement, or even a priority. Our code was required to conform to the
> C standard. We were allowed to assume POSIX conformance (though we made
> little use of that fact other than the fact that our build scripts were
> intended for POSIX sh, and our make files were intended for the POSIX
> make utility). We were otherwise prohibited from writing
> platform-specific code (not even if protected by #if* directives based
> upon platform-specific macros) - that includes depending upon gcc
> extensions.
>
I've done both. Currently my code targets clang on Mac and MSVC on
Windows. There's the occasional conditional directive, but fewer than you
might imagine, and mostly because the GUI routines are a pixel out.
But for my PhD Windows compatibility was not required. However I use
quite a few of the routines I developed for general-purpose use on
Windows.

Re: What is wrong with this?

<t3mn08$qtn$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21289&group=comp.lang.c#21289

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!aioe.org!Puiiztk9lHEEQC0y3uUjRA.user.46.165.242.75.POSTED!not-for-mail
From: non...@add.invalid (Manfred)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 18:11:52 +0200
Organization: Aioe.org NNTP Server
Message-ID: <t3mn08$qtn$1@gioia.aioe.org>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad>
<c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
<t3ml4e$1s7g$1@gioia.aioe.org>
<70902f4e-b4ef-4dc0-bd3d-0f64381da943n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="27575"; posting-host="Puiiztk9lHEEQC0y3uUjRA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Manfred - Tue, 19 Apr 2022 16:11 UTC

On 4/19/2022 5:48 PM, Malcolm McLean wrote:
> On Tuesday, 19 April 2022 at 16:40:11 UTC+1, Manfred wrote:
>> On 4/19/2022 4:43 PM, Malcolm McLean wrote:
>>> On Tuesday, 19 April 2022 at 15:07:48 UTC+1, Scott Lurndal wrote:
>>>> Andrey Tarasevich <andreyta...@hotmail.com> writes:
>>>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>>>
>>>>> When code does not compile in Visual Studio it is effectively useless.
>>>>> Compatibility with Visual Studio is a hard requirement for all C and C++
>>>>> code in professional world.
>>>> Now that's funny. I've been programming "in the professional world",
>>>> in C and C++ for forty years, and Visual Studio has _never_ been part
>>>> of that process. It's been considered a toy compiler by most.
>>>>
>>> It's not a good C compiler. But it's the most realistic option for compiling
>>> Windows programs, and there are often good reasons for writing programs
>>> to run on Windows.
>>> If you stick to a conservative subset of C89, you should be OK. So MSVC
>>> is a reason for sticking to that conservative subset.
>> I'd even say that /if/ you need to target Windows, it's probably the
>> best compiler for the job, in the sense that the benefit of platform
>> compatibility wins over the cost of lower standard compliance.
>>
>> However, the main fact is that MSVC is primarily designed as a C++
>> compiler, and even if, as you say, there are good reason to write
>> programs for Windows, most often these are C++ programs, rather than C.
>>
> If you know that the program will be targetted at Windows, and never
> run on any other platform, then generally you should go for C++ or C sharp,
> because of better compiler support.
> But if you are writing a general purpose routine, it will be easier to integrate
> with other code if it is in C. It can be given C++, C sharp, Objective C, or
> Python bindings quite easily. But it does need to compile under Visual C.
> So you should be quite conservative in your choice of C constructs. MSVC
> is now a lot better and, for example, supports the fixed width types, so
> "a conservative subset of C89" is maybe too restrictive.

Yes, that's especially true for libraries, for which portability is a
major requirement. C is definitely a common choice there, and you are
right that with C89 you're most probably good with MSVC too.

You were mentioning "programs", which made my comment drift towards end
user applications.
(C# is a very different animal, but that's out of topic here)

Re: What is wrong with this?

<t3mos5$k80g$1@news.mixmin.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21290&group=comp.lang.c#21290

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!.POSTED!not-for-mail
From: samlara...@gmail.com (Sams Lara)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 17:38:23 +0100
Organization: Microsoft Unofficial Representative on Newsgroups
Message-ID: <t3mos5$k80g$1@news.mixmin.net>
References: <t3k4n3$1ba2l$1@paganini.bofh.team>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 19 Apr 2022 16:43:49 -0000 (UTC)
Injection-Info: news.mixmin.net; posting-host="48d11a3b2fa45924111005cb39b9d63a5dfc88a3";
logging-data="663568"; mail-complaints-to="abuse@mixmin.net"
In-Reply-To: <t3k4n3$1ba2l$1@paganini.bofh.team>
Content-Language: en-US
 by: Sams Lara - Tue, 19 Apr 2022 16:38 UTC

On 18/04/2022 17:44, Jack Lemmon wrote:
> char get_char(const char *format, ...) __attribute__((format(printf, 1,
> 2)));
>
> I downloaded a free library file from this link:
> <https://github.com/cs50/libcs50/releases>
>
> But when I try to compile it, it faults at line 58 and other lines
> containing attribute world. So what exactly is likely to be wrong with it.?
> The library was created by Harvard uni for students to learn C
> programming so it must work on a Windows system using visual Studio, but
> it doesn't. What changes should I make to make it work?
>
>
I downloaded the source code from the link you provided and I ran a test
program in Visual Studio 2022. Initially, I got an error but when I
changed the configuration to look like in this picture
<https://i.imgur.com/m4Kxz6F.png>, it compiled and ran just fine as far
as I can tell!!!. I haven't tried all the functions given in the file
but they should all work if you know what they are supposed to do. I
tried just one to get a string from the command prompt and the test
program is this:

#include <stdio.h>
#include "cs50.h"

// For command Line use this:
// clang -o Prog.exe program.c cs50.c
// gcc -o Prog.exe program.c cs50.c

int main(void)
{ string name = get_string("What's your name? ");
printf("Hello, %s", name);
return 0;
}

You will need to install LLVM from Microsoft so if you want to know how
this is done then please post back. The Official site for LLVM only
gives compiled binaries in zip form so you can't just unzip the file and
expect Visual Studio to know about it. It needs to be installed so that
Windows can recognize the location.

Re: What is wrong with this?

<67b8ff1a-769b-4e2a-95ae-27632e922da3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21291&group=comp.lang.c#21291

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:caa:b0:441:2e8f:f398 with SMTP id s10-20020a0562140caa00b004412e8ff398mr12352233qvs.61.1650387596587;
Tue, 19 Apr 2022 09:59:56 -0700 (PDT)
X-Received: by 2002:a05:6214:1c87:b0:42d:20cb:e484 with SMTP id
ib7-20020a0562141c8700b0042d20cbe484mr12347656qvb.10.1650387596363; Tue, 19
Apr 2022 09:59:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 19 Apr 2022 09:59:56 -0700 (PDT)
In-Reply-To: <t3mos5$k80g$1@news.mixmin.net>
Injection-Info: google-groups.googlegroups.com; posting-host=179.152.28.66; posting-account=xFcAQAoAAAAoWlfpQ6Hz2n-MU9fthxbY
NNTP-Posting-Host: 179.152.28.66
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3mos5$k80g$1@news.mixmin.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <67b8ff1a-769b-4e2a-95ae-27632e922da3n@googlegroups.com>
Subject: Re: What is wrong with this?
From: thiago.a...@gmail.com (Thiago Adams)
Injection-Date: Tue, 19 Apr 2022 16:59:56 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Thiago Adams - Tue, 19 Apr 2022 16:59 UTC

On Tuesday, April 19, 2022 at 1:44:01 PM UTC-3, Sams Lara wrote:
> On 18/04/2022 17:44, Jack Lemmon wrote:
> > char get_char(const char *format, ...) __attribute__((format(printf, 1,
> > 2)));
> >
> > I downloaded a free library file from this link:
> > <https://github.com/cs50/libcs50/releases>
> >
> > But when I try to compile it, it faults at line 58 and other lines
> > containing attribute world. So what exactly is likely to be wrong with it.?
> > The library was created by Harvard uni for students to learn C
> > programming so it must work on a Windows system using visual Studio, but
> > it doesn't. What changes should I make to make it work?
> >
> >
> I downloaded the source code from the link you provided and I ran a test
> program in Visual Studio 2022. Initially, I got an error but when I
> changed the configuration to look like in this picture
> <https://i.imgur.com/m4Kxz6F.png>, it compiled and ran just fine as far
> as I can tell!!!. I haven't tried all the functions given in the file
> but they should all work if you know what they are supposed to do. I
> tried just one to get a string from the command prompt and the test
> program is this:
>
> #include <stdio.h>
> #include "cs50.h"
>
> // For command Line use this:
> // clang -o Prog.exe program.c cs50.c
> // gcc -o Prog.exe program.c cs50.c
>
> int main(void)
> {
> string name = get_string("What's your name? ");
> printf("Hello, %s", name);
> return 0;
> }
>
> You will need to install LLVM from Microsoft so if you want to know how
> this is done then please post back. The Official site for LLVM only
> gives compiled binaries in zip form so you can't just unzip the file and
> expect Visual Studio to know about it. It needs to be installed so that
> Windows can recognize the location.

Visual Studio has good suport for C99 and C11. You must change the settings.
No need to use clang but it is good to have.

Re: What is wrong with this?

<t3mrd6$meq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21292&group=comp.lang.c#21292

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: andreyta...@hotmail.com (Andrey Tarasevich)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 10:26:59 -0700
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <t3mrd6$meq$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 17:27:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="03fc7fe9c44de50fa3f970b3ed644889";
logging-data="23002"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1oGVxOnn4K9Zp3RE9W8VK"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Cancel-Lock: sha1:SfqZDmzZVnLopsQSCwPNQXfUMDU=
In-Reply-To: <Hmz7K.73578$e%.2483@fx36.iad>
Content-Language: en-US
 by: Andrey Tarasevich - Tue, 19 Apr 2022 17:26 UTC

On 4/19/2022 7:07 AM, Scott Lurndal wrote:
> Andrey Tarasevich <andreytarasevich@hotmail.com> writes:
>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>
>> When code does not compile in Visual Studio it is effectively useless.
>> Compatibility with Visual Studio is a hard requirement for all C and C++
>> code in professional world.
>
> Now that's funny. I've been programming "in the professional world",
> in C and C++ for forty years, and Visual Studio has _never_ been part
> of that process. It's been considered a toy compiler by most.

Um...

I while ago some guy in a C and C++ programming I had to post a piece of
C++ code that used a lambda expression. Some old-timer guy responded to
my post with something passive-aggressive along the lines of: "This is
bogus. I've been professionally programming in C for 40 years, but I
have never seen this syntax". I was genuinely stopped in my tracks for a
minute at least for a minute at least, speechless: so many things are
completely off in it.

Your post above conveys pretty much the same dumbfounding feel to me.

As I has already stated previously, aside from some understandable niche
areas, which amount to no more than mere statistical anomalies,
everything in professional programming world is done in Visual Studio,
regardless of the target platform. But since we are talking more about
the compilers, than about the development environments, what today's
state of affairs clearly demonstrated is that at certain level of
complexity community-developed software is still incapable of competing
with commercially-backed software. It is probably more about C++ that C,
but today Microsoft C and C++ compilers clearly dominate as the highest
quality industrial-grade compilers, with Clang being close second. And
the catastrophic decay of GCC is probably the most telling sign of this
situation. That one survives (just barely) purely on half-dead legacy
code and the inertia of low-quality educational usage, as in the example
above.

Yes, there are people who manage to get by using just any compiler, but
(and I apologize for re-using the analogy I already used more than once)
that is like saying that some people ride a mono-cycle to work. Yes,
such people exist and I actually know a professional programmer who
routinely rides to work on a mono-cycle.

--
Best regards,
Andrey Tarasevich

Re: What is wrong with this?

<t3msil$vbl$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21294&group=comp.lang.c#21294

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: andreyta...@hotmail.com (Andrey Tarasevich)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 10:46:58 -0700
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <t3msil$vbl$1@dont-email.me>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad>
<c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 19 Apr 2022 17:47:01 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="03fc7fe9c44de50fa3f970b3ed644889";
logging-data="32117"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Edk7m6EVdeVlIFfYNiJsd"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Cancel-Lock: sha1:Ay9XYNcMSot8XlbgM40S0DDo7lk=
In-Reply-To: <c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
Content-Language: en-US
 by: Andrey Tarasevich - Tue, 19 Apr 2022 17:46 UTC

On 4/19/2022 7:43 AM, Malcolm McLean wrote:
> On Tuesday, 19 April 2022 at 15:07:48 UTC+1, Scott Lurndal wrote:
>> Andrey Tarasevich <andreyta...@hotmail.com> writes:
>>> On 4/18/2022 9:44 AM, Jack Lemmon wrote:
>>
>>> When code does not compile in Visual Studio it is effectively useless.
>>> Compatibility with Visual Studio is a hard requirement for all C and C++
>>> code in professional world.
>> Now that's funny. I've been programming "in the professional world",
>> in C and C++ for forty years, and Visual Studio has _never_ been part
>> of that process. It's been considered a toy compiler by most.
>>
> It's not a good C compiler. But it's the most realistic option for compiling
> Windows programs, and there are often good reasons for writing programs
> to run on Windows.

All programs are written for Windows initially, since regardless of the
intended target platform, all everyday development and debugging is done
under Windows in Visual Studio anyway. For example, nobody in their
right mind develops Linux applications under the actual Linux (again,
aside from niche areas and... well... weirdos).

As I said before, any C and C++ library, targeting any platform, has to
be compatible with Visual Studio compilers to have a chance. Without
such compatibility, the library will never take off simply because
people won't be able to use it in their everyday development.

>> If you stick to a conservative subset of C89, you should be OK. So MSVC
>> is a reason for sticking to that conservative subset.

That sounds like a typical internet-grade lore.

With "classic" C things are simple: as C89/90 compiler Microsoft C
compiler has always served as universally recognized industry standard.

Moreover, somewhat surprisingly Microsoft C compiler has been recognized
as one of the best C99 compilers for quote a while (since 2013?), even
though at that time C99 support was not officially acknowledged by
Microsoft. Despite the fact that C99 support was not complete back then
(~90%?), it kinda "defined" the "meaningful subset" of C99 people
actually cared about. The primary reason why people shied away from VLA
and `_Generic` was lack of support in Microsoft subset of C99. Now, when
C99 support is official in Microsoft C compiler that era is over.

Bizarre references to some "conservative subsets" will only make you
look like a newbie who "wants to belong" and tries to use big-boy's
lingo, but only embarrasses himself instead.

--
Best regards,
Andrey Tarasevich

Re: What is wrong with this?

<875yn5dkm1.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21295&group=comp.lang.c#21295

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 10:54:46 -0700
Organization: None to speak of
Lines: 21
Message-ID: <875yn5dkm1.fsf@nosuchdomain.example.com>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3kvua$5p1$1@dont-email.me>
<Hmz7K.73578$e%.2483@fx36.iad>
<c97bc977-c232-4585-9ff8-70a16dc9a50an@googlegroups.com>
<t3msil$vbl$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="1855fc4cc6690b5d31530deb488223df";
logging-data="21884"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18R/idtCqdlpppZTF7/lyuq"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:l5Xe/mcyor03MpMMtVRHY9PoCLU=
sha1:LzzwGCq1P/HZRnTZAog0oZMcyCg=
 by: Keith Thompson - Tue, 19 Apr 2022 17:54 UTC

Andrey Tarasevich <andreytarasevich@hotmail.com> writes:
[...]
> All programs are written for Windows initially, since regardless of
> the intended target platform, all everyday development and debugging
> is done under Windows in Visual Studio anyway. For example, nobody in
> their right mind develops Linux applications under the actual Linux
> (again, aside from niche areas and... well... weirdos).

I don't know whether you're trolling or mistaken, but that's simply not
true. If you actually believe that, consider that other people might
have experiences that differ from yours.

In my previous job, for example, I worked on Linux, targeting embedded
Linux, using gcc, and I didn't even have a Windows machine at work.

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Re: What is wrong with this?

<t3mtrd$350mv$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21296&group=comp.lang.c#21296

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Re: What is wrong with this?
Date: Tue, 19 Apr 2022 18:08:45 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <t3mtrd$350mv$1@news.xmission.com>
References: <t3k4n3$1ba2l$1@paganini.bofh.team> <t3ml4e$1s7g$1@gioia.aioe.org> <70902f4e-b4ef-4dc0-bd3d-0f64381da943n@googlegroups.com> <t3mn08$qtn$1@gioia.aioe.org>
Injection-Date: Tue, 19 Apr 2022 18:08:45 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3310303"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Tue, 19 Apr 2022 18:08 UTC

In article <t3mn08$qtn$1@gioia.aioe.org>, Manfred <noname@add.invalid> wrote:
....
>(C# is a very different animal, but that's off topic here)

As is C++, Fortran, and BAL.

--

Prayer has no place in the public schools, just like facts
have no place in organized religion.
-- Superintendent Chalmers

Pages:123
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor