Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #98007 > unrolled thread
| Started by | Potomac <ravine557@gmail.com> |
|---|---|
| First post | 2016-12-05 06:32 -0800 |
| Last post | 2016-12-12 04:18 +0000 |
| Articles | 20 on this page of 107 — 18 participants |
Back to article view | Back to comp.lang.c
Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Potomac <ravine557@gmail.com> - 2016-12-05 06:32 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-05 08:34 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-05 15:43 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-05 10:41 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-05 15:37 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops John Bode <jfbode1029@gmail.com> - 2016-12-05 10:43 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops potomac <ravine557@gmail.com> - 2016-12-07 01:13 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-07 10:55 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Philip Lantz <prl@canterey.us> - 2016-12-07 20:34 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-08 11:08 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ian Collins <ian-news@hotmail.com> - 2016-12-08 08:23 +1300
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops potomac <ravine557@gmail.com> - 2016-12-07 01:07 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-07 08:46 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 16:23 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops potomac <ravine557@gmail.com> - 2016-12-07 01:12 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-07 08:49 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops John Bode <jfbode1029@gmail.com> - 2016-12-07 15:07 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops potomac <ravine557@gmail.com> - 2016-12-07 03:46 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-07 11:59 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 12:05 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-07 09:40 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-07 15:13 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 20:24 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-07 16:28 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 21:48 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-07 17:02 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 22:19 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-07 17:27 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 22:51 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 09:10 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 14:13 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops David Brown <david.brown@hesbynett.no> - 2016-12-08 15:57 +0100
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ian Collins <ian-news@hotmail.com> - 2016-12-08 18:02 +1300
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-08 08:48 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-07 15:33 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 09:13 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 14:22 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops David Brown <david.brown@hesbynett.no> - 2016-12-08 16:03 +0100
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 10:44 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Melzzzzz <Melzzzzz@zzzzz.com> - 2016-12-08 15:48 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 21:41 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-08 16:16 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 21:47 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-08 20:16 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops David Brown <david.brown@hesbynett.no> - 2016-12-09 11:19 +0100
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops supercat@casperkitty.com - 2016-12-09 08:00 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-13 13:10 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-13 13:55 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-15 01:13 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-15 07:02 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-15 19:56 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops supercat@casperkitty.com - 2016-12-18 10:00 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops supercat@casperkitty.com - 2016-12-14 11:45 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-14 12:14 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-15 01:24 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops supercat@casperkitty.com - 2016-12-15 08:02 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-15 12:10 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Philip Lantz <prl@canterey.us> - 2016-12-16 20:00 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 11:05 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 16:21 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-09 13:10 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 23:44 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops supercat@casperkitty.com - 2016-12-10 10:18 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 16:18 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 08:26 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 11:15 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 16:31 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 23:47 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-11 16:05 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 16:21 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-11 23:15 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 18:57 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 00:05 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 21:09 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-12 08:25 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Tim Rentsch <txr@alumni.caltech.edu> - 2016-12-10 07:59 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-08 13:51 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-08 13:34 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-08 21:52 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-08 19:33 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 11:20 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops jameskuyper@verizon.net - 2016-12-09 13:28 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 23:51 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 16:46 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops "James R. Kuyper" <jameskuyper@verizon.net> - 2016-12-09 13:55 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 20:17 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-07 12:23 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops twalker470@googlemail.com - 2016-12-07 05:50 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-07 08:55 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-07 16:23 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-07 10:56 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops potomac <ravine557@gmail.com> - 2016-12-07 04:14 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Barry Schwarz <schwarzb@dqel.com> - 2016-12-07 11:03 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops John Bode <jfbode1029@gmail.com> - 2016-12-09 08:06 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Keith Thompson <kst-u@mib.org> - 2016-12-09 09:23 -0800
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 17:38 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops "James R. Kuyper" <jameskuyper@verizon.net> - 2016-12-09 14:01 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Richard Heathfield <rjh@cpax.org.uk> - 2016-12-09 19:09 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-12-09 12:38 -0700
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-10 00:08 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-10 00:16 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-09 23:59 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-10 11:51 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 16:22 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-11 21:52 +0000
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Jerry Stuckle <jstucklex@attglobal.net> - 2016-12-11 22:32 -0500
Re: Stumped on the role of a particular statement in a program with Arrays & Nested For Loops Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-12-12 04:18 +0000
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-07 09:40 -0800 |
| Message-ID | <ln8trr3ae0.fsf@kst-u.example.com> |
| In reply to | #98249 |
Richard Heathfield <rjh@cpax.org.uk> writes:
[...]
>> Someone told me to put this line before the statements, but it
>> doesn't make the error message go away. What would you suggest?
>>
>> #define _CRT_SECURE_NO_DEPRECATE
>
> That used to work. The pragma still works. But neither of them should be
> necessary --- the compiler is /required/ to support scanf without adding
> anything special to the source code. Otherwise, if you bought it
> believing it to be a conforming C compiler, and if it were advertised to
> you as such, and if that conformance was a reason for your selecting the
> product, it should be reasonably easy to get your money back.
Most C compilers are not conforming by default, and require some added
options to make them (attempt to) conform to (some version of) the
standard.
If that option requires modifying your source code, then the compiler is
not conforming at all. But there's *probably* some way to get MSVC to
attempt to conform (supporting scanf() et al) without modifying your
source code. I don't happen to know how to do that.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-07 15:13 -0500 |
| Message-ID | <o29qee$alb$2@jstuckle.eternal-september.org> |
| In reply to | #98276 |
On 12/7/2016 12:40 PM, Keith Thompson wrote: > Richard Heathfield <rjh@cpax.org.uk> writes: > [...] >>> Someone told me to put this line before the statements, but it >>> doesn't make the error message go away. What would you suggest? >>> >>> #define _CRT_SECURE_NO_DEPRECATE >> >> That used to work. The pragma still works. But neither of them should be >> necessary --- the compiler is /required/ to support scanf without adding >> anything special to the source code. Otherwise, if you bought it >> believing it to be a conforming C compiler, and if it were advertised to >> you as such, and if that conformance was a reason for your selecting the >> product, it should be reasonably easy to get your money back. > > Most C compilers are not conforming by default, and require some added > options to make them (attempt to) conform to (some version of) the > standard. > Why do you say that? There is nothing that says a compiler can't add features, as long as it does everything the standard says it does. > If that option requires modifying your source code, then the compiler is > not conforming at all. But there's *probably* some way to get MSVC to > attempt to conform (supporting scanf() et al) without modifying your > source code. I don't happen to know how to do that. > If you're not using any of the compiler extensions and stick with standard C, you shouldn't have to change any code. If you have to change code, it's much more probable your *code* is non-conforming, not the standard. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-07 20:24 +0000 |
| Message-ID | <o29r38$evu$1@dont-email.me> |
| In reply to | #98288 |
On 07/12/16 20:13, Jerry Stuckle wrote: > On 12/7/2016 12:40 PM, Keith Thompson wrote: >> Richard Heathfield <rjh@cpax.org.uk> writes: >> [...] >>>> Someone told me to put this line before the statements, but it >>>> doesn't make the error message go away. What would you suggest? >>>> >>>> #define _CRT_SECURE_NO_DEPRECATE >>> >>> That used to work. The pragma still works. But neither of them should be >>> necessary --- the compiler is /required/ to support scanf without adding >>> anything special to the source code. Otherwise, if you bought it >>> believing it to be a conforming C compiler, and if it were advertised to >>> you as such, and if that conformance was a reason for your selecting the >>> product, it should be reasonably easy to get your money back. >> >> Most C compilers are not conforming by default, and require some added >> options to make them (attempt to) conform to (some version of) the >> standard. >> > > Why do you say that? There is nothing that says a compiler can't add > features, as long as it does everything the standard says it does. So if it doesn't let you use scanf, it's non-conforming, which (according to the OP's report) is precisely the case here. I haven't confirmed whether the OP is correct in this report but, if he is, then Visual Studio is non-conforming when it fails to compile a program that uses scanf. >> If that option requires modifying your source code, then the compiler is >> not conforming at all. But there's *probably* some way to get MSVC to >> attempt to conform (supporting scanf() et al) without modifying your >> source code. I don't happen to know how to do that. >> > > If you're not using any of the compiler extensions and stick with > standard C, you shouldn't have to change any code. If you have to > change code, it's much more probable your *code* is non-conforming, not > the standard. Well, presumably you mean "not the compiler" at the end there, rather than "not the standard". Did you not read the thread before posting? The issue is that the OP reports his compiler's refusal to translate a program containing a correct call to scanf, /because/ it contains a call to scanf. If that report is correct, the compiler is non-conforming in the mode in which it was invoked, which is /precisely/ what Keith was saying --- that compilers very often need a bit of a kicking to get them into conforming mode. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-07 16:28 -0500 |
| Message-ID | <o29uru$smv$1@jstuckle.eternal-september.org> |
| In reply to | #98292 |
On 12/7/2016 3:24 PM, Richard Heathfield wrote: > On 07/12/16 20:13, Jerry Stuckle wrote: >> On 12/7/2016 12:40 PM, Keith Thompson wrote: >>> Richard Heathfield <rjh@cpax.org.uk> writes: >>> [...] >>>>> Someone told me to put this line before the statements, but it >>>>> doesn't make the error message go away. What would you suggest? >>>>> >>>>> #define _CRT_SECURE_NO_DEPRECATE >>>> >>>> That used to work. The pragma still works. But neither of them >>>> should be >>>> necessary --- the compiler is /required/ to support scanf without >>>> adding >>>> anything special to the source code. Otherwise, if you bought it >>>> believing it to be a conforming C compiler, and if it were >>>> advertised to >>>> you as such, and if that conformance was a reason for your selecting >>>> the >>>> product, it should be reasonably easy to get your money back. >>> >>> Most C compilers are not conforming by default, and require some added >>> options to make them (attempt to) conform to (some version of) the >>> standard. >>> >> >> Why do you say that? There is nothing that says a compiler can't add >> features, as long as it does everything the standard says it does. > > So if it doesn't let you use scanf, it's non-conforming, which > (according to the OP's report) is precisely the case here. I haven't > confirmed whether the OP is correct in this report but, if he is, then > Visual Studio is non-conforming when it fails to compile a program that > uses scanf. > The question wasn't about whether VS compiled a program with scanf() or not. The question was why he stated "Most C compilers are not conforming by default". Nothing at all in that statement about VS or scanf. >>> If that option requires modifying your source code, then the compiler is >>> not conforming at all. But there's *probably* some way to get MSVC to >>> attempt to conform (supporting scanf() et al) without modifying your >>> source code. I don't happen to know how to do that. >>> >> >> If you're not using any of the compiler extensions and stick with >> standard C, you shouldn't have to change any code. If you have to >> change code, it's much more probable your *code* is non-conforming, not >> the standard. > > Well, presumably you mean "not the compiler" at the end there, rather > than "not the standard". > Yes, I meant not the compiler. > Did you not read the thread before posting? The issue is that the OP > reports his compiler's refusal to translate a program containing a > correct call to scanf, /because/ it contains a call to scanf. If that > report is correct, the compiler is non-conforming in the mode in which > it was invoked, which is /precisely/ what Keith was saying --- that > compilers very often need a bit of a kicking to get them into conforming > mode. > Yes, I read the thread. But I was responding to an over-generalized statement. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-07 21:48 +0000 |
| Message-ID | <o2a002$10f$1@dont-email.me> |
| In reply to | #98299 |
On 07/12/16 21:28, Jerry Stuckle wrote: > On 12/7/2016 3:24 PM, Richard Heathfield wrote: >> On 07/12/16 20:13, Jerry Stuckle wrote: >>> On 12/7/2016 12:40 PM, Keith Thompson wrote: <snip> >>>> Most C compilers are not conforming by default, and require some added >>>> options to make them (attempt to) conform to (some version of) the >>>> standard. >>>> >>> >>> Why do you say that? There is nothing that says a compiler can't add >>> features, as long as it does everything the standard says it does. >> >> So if it doesn't let you use scanf, it's non-conforming, which >> (according to the OP's report) is precisely the case here. I haven't >> confirmed whether the OP is correct in this report but, if he is, then >> Visual Studio is non-conforming when it fails to compile a program that >> uses scanf. >> > > The question wasn't about whether VS compiled a program with scanf() or > not. The question was why he stated "Most C compilers are not > conforming by default". Okay, that's a fair comment. So I suppose the question (not just to you, but generally to the group) is: are there any compilers that conform by default, i.e. without setting any special switches? <snip> -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-07 17:02 -0500 |
| Message-ID | <o2a0qc$344$2@jstuckle.eternal-september.org> |
| In reply to | #98301 |
On 12/7/2016 4:48 PM, Richard Heathfield wrote: > On 07/12/16 21:28, Jerry Stuckle wrote: >> On 12/7/2016 3:24 PM, Richard Heathfield wrote: >>> On 07/12/16 20:13, Jerry Stuckle wrote: >>>> On 12/7/2016 12:40 PM, Keith Thompson wrote: > > <snip> > >>>>> Most C compilers are not conforming by default, and require some added >>>>> options to make them (attempt to) conform to (some version of) the >>>>> standard. >>>>> >>>> >>>> Why do you say that? There is nothing that says a compiler can't add >>>> features, as long as it does everything the standard says it does. >>> >>> So if it doesn't let you use scanf, it's non-conforming, which >>> (according to the OP's report) is precisely the case here. I haven't >>> confirmed whether the OP is correct in this report but, if he is, then >>> Visual Studio is non-conforming when it fails to compile a program that >>> uses scanf. >>> >> >> The question wasn't about whether VS compiled a program with scanf() or >> not. The question was why he stated "Most C compilers are not >> conforming by default". > > Okay, that's a fair comment. So I suppose the question (not just to you, > but generally to the group) is: are there any compilers that conform by > default, i.e. without setting any special switches? > > <snip> > I think most of them do. But being conforming doesn't mean they have to flag non-conforming code. I don't know of any (other than perhaps VS - I haven't used it for a few years) which won't compile conforming code. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-07 22:19 +0000 |
| Message-ID | <o2a1r9$7m7$1@dont-email.me> |
| In reply to | #98305 |
On 07/12/16 22:02, Jerry Stuckle wrote: > On 12/7/2016 4:48 PM, Richard Heathfield wrote: >> On 07/12/16 21:28, Jerry Stuckle wrote: >>> On 12/7/2016 3:24 PM, Richard Heathfield wrote: >>>> On 07/12/16 20:13, Jerry Stuckle wrote: >>>>> On 12/7/2016 12:40 PM, Keith Thompson wrote: >> >> <snip> >> >>>>>> Most C compilers are not conforming by default, and require some added >>>>>> options to make them (attempt to) conform to (some version of) the >>>>>> standard. >>>>>> >>>>> >>>>> Why do you say that? There is nothing that says a compiler can't add >>>>> features, as long as it does everything the standard says it does. >>>> >>>> So if it doesn't let you use scanf, it's non-conforming, which >>>> (according to the OP's report) is precisely the case here. I haven't >>>> confirmed whether the OP is correct in this report but, if he is, then >>>> Visual Studio is non-conforming when it fails to compile a program that >>>> uses scanf. >>>> >>> >>> The question wasn't about whether VS compiled a program with scanf() or >>> not. The question was why he stated "Most C compilers are not >>> conforming by default". >> >> Okay, that's a fair comment. So I suppose the question (not just to you, >> but generally to the group) is: are there any compilers that conform by >> default, i.e. without setting any special switches? >> >> <snip> >> > > I think most of them do. But being conforming doesn't mean they have to > flag non-conforming code. It does mean precisely that if the code's non-conformance is a constraint violation or a syntax error. > I don't know of any (other than perhaps VS - > I haven't used it for a few years) which won't compile conforming code. Well, here's one for you: gcc doesn't conform by default. Here's an example: $ cat ct.c ??=include <stdio.h> int main(void) ??< return 0; ??> $ gcc -o ct ct.c ct.c:1:1: warning: trigraph ??= ignored, use -trigraphs to enable [-Wtrigraphs] ??=include <stdio.h> ^ ct.c:1:1: error: expected identifier or ‘(’ before ‘?’ token ??=include <stdio.h> ^ ct.c:4:1: warning: trigraph ??< ignored, use -trigraphs to enable [-Wtrigraphs] ??< ^ ct.c:6:1: warning: trigraph ??> ignored, use -trigraphs to enable [-Wtrigraphs] ??> ^ ct.c:6:1: error: expected identifier or ‘(’ before ‘?’ token ??> ^ But when we kick it into conforming mode, it's fine: $ gcc -std=c90 -pedantic -o ct ct.c $ -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-07 17:27 -0500 |
| Message-ID | <o2a2ab$97e$1@jstuckle.eternal-september.org> |
| In reply to | #98308 |
On 12/7/2016 5:19 PM, Richard Heathfield wrote: > On 07/12/16 22:02, Jerry Stuckle wrote: >> On 12/7/2016 4:48 PM, Richard Heathfield wrote: >>> On 07/12/16 21:28, Jerry Stuckle wrote: >>>> On 12/7/2016 3:24 PM, Richard Heathfield wrote: >>>>> On 07/12/16 20:13, Jerry Stuckle wrote: >>>>>> On 12/7/2016 12:40 PM, Keith Thompson wrote: >>> >>> <snip> >>> >>>>>>> Most C compilers are not conforming by default, and require some >>>>>>> added >>>>>>> options to make them (attempt to) conform to (some version of) the >>>>>>> standard. >>>>>>> >>>>>> >>>>>> Why do you say that? There is nothing that says a compiler can't add >>>>>> features, as long as it does everything the standard says it does. >>>>> >>>>> So if it doesn't let you use scanf, it's non-conforming, which >>>>> (according to the OP's report) is precisely the case here. I haven't >>>>> confirmed whether the OP is correct in this report but, if he is, then >>>>> Visual Studio is non-conforming when it fails to compile a program >>>>> that >>>>> uses scanf. >>>>> >>>> >>>> The question wasn't about whether VS compiled a program with scanf() or >>>> not. The question was why he stated "Most C compilers are not >>>> conforming by default". >>> >>> Okay, that's a fair comment. So I suppose the question (not just to you, >>> but generally to the group) is: are there any compilers that conform by >>> default, i.e. without setting any special switches? >>> >>> <snip> >>> >> >> I think most of them do. But being conforming doesn't mean they have to >> flag non-conforming code. > > It does mean precisely that if the code's non-conformance is a > constraint violation or a syntax error. > Where does it state that? >> I don't know of any (other than perhaps VS - >> I haven't used it for a few years) which won't compile conforming code. > > Well, here's one for you: gcc doesn't conform by default. Here's an > example: > > $ cat ct.c > ??=include <stdio.h> > > int main(void) > ??< > return 0; > ??> > > $ gcc -o ct ct.c > ct.c:1:1: warning: trigraph ??= ignored, use -trigraphs to enable > [-Wtrigraphs] > ??=include <stdio.h> > ^ > ct.c:1:1: error: expected identifier or ‘(’ before ‘?’ token > ??=include <stdio.h> > ^ > ct.c:4:1: warning: trigraph ??< ignored, use -trigraphs to enable > [-Wtrigraphs] > ??< > ^ > ct.c:6:1: warning: trigraph ??> ignored, use -trigraphs to enable > [-Wtrigraphs] > ??> > ^ > ct.c:6:1: error: expected identifier or ‘(’ before ‘?’ token > ??> > ^ > > But when we kick it into conforming mode, it's fine: > > $ gcc -std=c90 -pedantic -o ct ct.c > $ > > Fair enough. I never use trigraphs (never found a need for them, and they're just that much more typing), so I wasn't aware gcc did that. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-07 22:51 +0000 |
| Message-ID | <o2a3m9$dg4$1@dont-email.me> |
| In reply to | #98310 |
On 07/12/16 22:27, Jerry Stuckle wrote: > On 12/7/2016 5:19 PM, Richard Heathfield wrote: >> On 07/12/16 22:02, Jerry Stuckle wrote: >>> On 12/7/2016 4:48 PM, Richard Heathfield wrote: >>>> On 07/12/16 21:28, Jerry Stuckle wrote: <snip> >>>>> The question wasn't about whether VS compiled a program with >>>>> scanf() or not. The question was why he stated "Most C >>>>> compilers are not conforming by default". >>>> >>>> Okay, that's a fair comment. So I suppose the question (not >>>> just to you, but generally to the group) is: are there any >>>> compilers that conform by default, i.e. without setting any >>>> special switches? >>>> >>>> <snip> >>>> >>> >>> I think most of them do. But being conforming doesn't mean they >>> have to flag non-conforming code. >> >> It does mean precisely that if the code's non-conformance is a >> constraint violation or a syntax error. >> > > Where does it state that? 5.1.1.3 Diagnostics A conforming implementation shall produce at least one diagnostic message (identified in an implementation-defined manner) if a preprocessing translation unit or translation unit contains a violation of any syntax rule or constraint, even if the behavior is also explicitly specified as undefined or implementation-defined. Diagnostic messages need not be produced in other circumstances. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-08 09:10 -0500 |
| Message-ID | <o2bpi8$2rv$1@jstuckle.eternal-september.org> |
| In reply to | #98319 |
On 12/7/2016 5:51 PM, Richard Heathfield wrote: > On 07/12/16 22:27, Jerry Stuckle wrote: >> On 12/7/2016 5:19 PM, Richard Heathfield wrote: >>> On 07/12/16 22:02, Jerry Stuckle wrote: >>>> On 12/7/2016 4:48 PM, Richard Heathfield wrote: >>>>> On 07/12/16 21:28, Jerry Stuckle wrote: > <snip> >>>>>> The question wasn't about whether VS compiled a program with >>>>>> scanf() or not. The question was why he stated "Most C >>>>>> compilers are not conforming by default". >>>>> >>>>> Okay, that's a fair comment. So I suppose the question (not >>>>> just to you, but generally to the group) is: are there any >>>>> compilers that conform by default, i.e. without setting any >>>>> special switches? >>>>> >>>>> <snip> >>>>> >>>> >>>> I think most of them do. But being conforming doesn't mean they >>>> have to flag non-conforming code. >>> >>> It does mean precisely that if the code's non-conformance is a >>> constraint violation or a syntax error. >>> >> >> Where does it state that? > > 5.1.1.3 Diagnostics > > A conforming implementation shall produce at least one diagnostic > message (identified in an implementation-defined manner) if a > preprocessing translation unit or translation unit contains a violation > of any syntax rule or constraint, even if the behavior is also > explicitly specified as undefined or implementation-defined. Diagnostic > messages need not be produced in other circumstances. > OK, so in gcc you state which version of the standard applies, and it spits out the diagnostic. But the I guess you would need that when a compiler works with multiple standards. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-08 14:13 +0000 |
| Message-ID | <o2bpn7$3k5$1@dont-email.me> |
| In reply to | #98353 |
On 08/12/16 14:10, Jerry Stuckle wrote: > On 12/7/2016 5:51 PM, Richard Heathfield wrote: >> On 07/12/16 22:27, Jerry Stuckle wrote: >>> On 12/7/2016 5:19 PM, Richard Heathfield wrote: >>>> On 07/12/16 22:02, Jerry Stuckle wrote: >>>>> On 12/7/2016 4:48 PM, Richard Heathfield wrote: >>>>>> On 07/12/16 21:28, Jerry Stuckle wrote: >> <snip> >>>>>>> The question wasn't about whether VS compiled a program with >>>>>>> scanf() or not. The question was why he stated "Most C >>>>>>> compilers are not conforming by default". >>>>>> >>>>>> Okay, that's a fair comment. So I suppose the question (not >>>>>> just to you, but generally to the group) is: are there any >>>>>> compilers that conform by default, i.e. without setting any >>>>>> special switches? >>>>>> >>>>>> <snip> >>>>>> >>>>> >>>>> I think most of them do. But being conforming doesn't mean they >>>>> have to flag non-conforming code. >>>> >>>> It does mean precisely that if the code's non-conformance is a >>>> constraint violation or a syntax error. >>>> >>> >>> Where does it state that? >> >> 5.1.1.3 Diagnostics >> >> A conforming implementation shall produce at least one diagnostic >> message (identified in an implementation-defined manner) if a >> preprocessing translation unit or translation unit contains a violation >> of any syntax rule or constraint, even if the behavior is also >> explicitly specified as undefined or implementation-defined. Diagnostic >> messages need not be produced in other circumstances. >> > > OK, so in gcc you state which version of the standard applies, and it > spits out the diagnostic. > > But the I guess you would need that when a compiler works with multiple > standards. Right. But *by default* gcc doesn't conform to *any* ISO standard. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-12-08 15:57 +0100 |
| Message-ID | <o2bsas$cj5$1@dont-email.me> |
| In reply to | #98355 |
On 08/12/16 15:13, Richard Heathfield wrote: > On 08/12/16 14:10, Jerry Stuckle wrote: >> On 12/7/2016 5:51 PM, Richard Heathfield wrote: >>> On 07/12/16 22:27, Jerry Stuckle wrote: >>>> On 12/7/2016 5:19 PM, Richard Heathfield wrote: >>>>> On 07/12/16 22:02, Jerry Stuckle wrote: >>>>>> On 12/7/2016 4:48 PM, Richard Heathfield wrote: >>>>>>> On 07/12/16 21:28, Jerry Stuckle wrote: >>> <snip> >>>>>>>> The question wasn't about whether VS compiled a program with >>>>>>>> scanf() or not. The question was why he stated "Most C >>>>>>>> compilers are not conforming by default". >>>>>>> >>>>>>> Okay, that's a fair comment. So I suppose the question (not >>>>>>> just to you, but generally to the group) is: are there any >>>>>>> compilers that conform by default, i.e. without setting any >>>>>>> special switches? >>>>>>> >>>>>>> <snip> >>>>>>> >>>>>> >>>>>> I think most of them do. But being conforming doesn't mean they >>>>>> have to flag non-conforming code. >>>>> >>>>> It does mean precisely that if the code's non-conformance is a >>>>> constraint violation or a syntax error. >>>>> >>>> >>>> Where does it state that? >>> >>> 5.1.1.3 Diagnostics >>> >>> A conforming implementation shall produce at least one diagnostic >>> message (identified in an implementation-defined manner) if a >>> preprocessing translation unit or translation unit contains a violation >>> of any syntax rule or constraint, even if the behavior is also >>> explicitly specified as undefined or implementation-defined. Diagnostic >>> messages need not be produced in other circumstances. >>> >> >> OK, so in gcc you state which version of the standard applies, and it >> spits out the diagnostic. >> >> But the I guess you would need that when a compiler works with multiple >> standards. > > Right. But *by default* gcc doesn't conform to *any* ISO standard. > Exactly - by default, it's standard is "gnu11" for current gcc. That is, C11 with gcc extensions. And while most gcc extensions are not conflicting (they often use implementation-reserved names), in conforming mode some should give diagnostics because they are syntax errors. And in some cases there are direct conflicts, such as "asm" being a keyword in the gcc extensions, but a valid user identifier in conforming mode.
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-12-08 18:02 +1300 |
| Message-ID | <eas7r7F5s31U2@mid.individual.net> |
| In reply to | #98301 |
On 12/ 8/16 10:48 AM, Richard Heathfield wrote: > On 07/12/16 21:28, Jerry Stuckle wrote: >> On 12/7/2016 3:24 PM, Richard Heathfield wrote: >>> On 07/12/16 20:13, Jerry Stuckle wrote: >>>> On 12/7/2016 12:40 PM, Keith Thompson wrote: > > <snip> > >>>>> Most C compilers are not conforming by default, and require some added >>>>> options to make them (attempt to) conform to (some version of) the >>>>> standard. >>>>> >>>> >>>> Why do you say that? There is nothing that says a compiler can't add >>>> features, as long as it does everything the standard says it does. >>> >>> So if it doesn't let you use scanf, it's non-conforming, which >>> (according to the OP's report) is precisely the case here. I haven't >>> confirmed whether the OP is correct in this report but, if he is, then >>> Visual Studio is non-conforming when it fails to compile a program that >>> uses scanf. >>> >> >> The question wasn't about whether VS compiled a program with scanf() or >> not. The question was why he stated "Most C compilers are not >> conforming by default". > > Okay, that's a fair comment. So I suppose the question (not just to you, > but generally to the group) is: are there any compilers that conform by > default, i.e. without setting any special switches? Sun/Oracle's compilers are or at least try to be conforming (to the current standard when it was released) by default. -- Ian
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2016-12-08 08:48 -0800 |
| Message-ID | <lnlgvqz7ri.fsf@kst-u.example.com> |
| In reply to | #98336 |
Ian Collins <ian-news@hotmail.com> writes:
> On 12/ 8/16 10:48 AM, Richard Heathfield wrote:
[...]
>> Okay, that's a fair comment. So I suppose the question (not just to you,
>> but generally to the group) is: are there any compilers that conform by
>> default, i.e. without setting any special switches?
>
> Sun/Oracle's compilers are or at least try to be conforming (to the
> current standard when it was released) by default.
I have access to a SPARC Solaris 9 system with Sun Studio 12 from 2007.
This program:
#include <stdio.h>
int main(void) {
printf("%ld\n", __STDC_VERSION__); // comment
}
produces this output:
199409
which indicates conformance to ISO/IEC 9899:1990/Amendment 1:1995 (E).
There are no compile-time diagnostics when compiled with no options.
It should have diagnosed the syntax error (C95 doesn't have //
comments).
Admittedly that's an old version of the compiler. Perhaps newer
versions are (more) conforming by default.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | jameskuyper@verizon.net |
|---|---|
| Date | 2016-12-07 15:33 -0800 |
| Message-ID | <457e17cb-a12e-4b3a-848a-04ec52607717@googlegroups.com> |
| In reply to | #98288 |
On Wednesday, December 7, 2016 at 3:13:27 PM UTC-5, Jerry Stuckle wrote: > On 12/7/2016 12:40 PM, Keith Thompson wrote: ... > > Most C compilers are not conforming by default, and require some added > > options to make them (atte I > > > > Why do you say that? There is nothing that says a compiler can't add > features, as long as it does everything the standard says it does. ... and doesn't do anything the standard says is shouldn't do. However, it turns out that most compilers do in fact fail to do something required by the standard, or do something prohibited by the standard, when invoked in their default mode. The compilers I've used most frequently over the past couple of decades all take an -ansi option that puts them in C90 mode; without that option, they don't fully conform to any version of the C standard. Most of them also require the -lm option to correctly handle code that uses <math.h>, and gcc also requires -pedantic. There was an extended discussion of this issue a few years ago in this newsgroup. In the end, only two very obscure compilers were identified that supposedly fully conformed in their default mode - and given how obscure they were, that conclusion might have simply been the result of nobody being aware of the the ways that they failed to conform.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-08 09:13 -0500 |
| Message-ID | <o2bpmt$2rv$2@jstuckle.eternal-september.org> |
| In reply to | #98325 |
On 12/7/2016 6:33 PM, jameskuyper@verizon.net wrote: > On Wednesday, December 7, 2016 at 3:13:27 PM UTC-5, Jerry Stuckle wrote: >> On 12/7/2016 12:40 PM, Keith Thompson wrote: > ... >>> Most C compilers are not conforming by default, and require some added >>> options to make them (atte > I >>> >> >> Why do you say that? There is nothing that says a compiler can't add >> features, as long as it does everything the standard says it does. > > ... and doesn't do anything the standard says is shouldn't do. However, it > turns out that most compilers do in fact fail to do something required by the > standard, or do something prohibited by the standard, when invoked in their > default mode. The compilers I've used most frequently over the past couple of > decades all take an -ansi option that puts them in C90 mode; without > that option, they don't fully conform to any version of the C standard. Most of > them also require the -lm option to correctly handle code that uses <math.h>, > and gcc also requires -pedantic. There was an extended discussion of this issue > a few years ago in this newsgroup. In the end, only two very obscure compilers > were identified that supposedly fully conformed in their default mode - and > given how obscure they were, that conclusion might have simply been the result > of nobody being aware of the the ways that they failed to conform. > When they support multiple versions of the standard, they need to know which version of the standard to use. But -lm is a linker parameter, not compiler. And I always thought gcc was -pedantic. I didn't realize it needed a flag to make it even more so. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <rjh@cpax.org.uk> |
|---|---|
| Date | 2016-12-08 14:22 +0000 |
| Message-ID | <o2bq80$5lc$1@dont-email.me> |
| In reply to | #98354 |
On 08/12/16 14:13, Jerry Stuckle wrote: > On 12/7/2016 6:33 PM, jameskuyper@verizon.net wrote: >> On Wednesday, December 7, 2016 at 3:13:27 PM UTC-5, Jerry Stuckle wrote: >>> On 12/7/2016 12:40 PM, Keith Thompson wrote: >> ... >>>> Most C compilers are not conforming by default, and require some added >>>> options to make them (atte >> I >>>> >>> >>> Why do you say that? There is nothing that says a compiler can't add >>> features, as long as it does everything the standard says it does. >> >> ... and doesn't do anything the standard says is shouldn't do. However, it >> turns out that most compilers do in fact fail to do something required by the >> standard, or do something prohibited by the standard, when invoked in their >> default mode. The compilers I've used most frequently over the past couple of >> decades all take an -ansi option that puts them in C90 mode; without >> that option, they don't fully conform to any version of the C standard. Most of >> them also require the -lm option to correctly handle code that uses <math.h>, >> and gcc also requires -pedantic. There was an extended discussion of this issue >> a few years ago in this newsgroup. In the end, only two very obscure compilers >> were identified that supposedly fully conformed in their default mode - and >> given how obscure they were, that conclusion might have simply been the result >> of nobody being aware of the the ways that they failed to conform. >> > > When they support multiple versions of the standard, they need to know > which version of the standard to use. And so they require a switch, without which they are non-conforming to any standard (or at least that's the case for gcc). > But -lm is a linker parameter, not compiler. Yes. Since we have been using the word "compiler" it's a reasonable objection. Nevertheless, if we take the linker out of the equation, *no* compiler is conforming, because to leave out the linker necessarily means leaving out TP8! And if we put the linker back into the equation, gcc fails to conform even when told to by -std=c??, unless the additional magic rune -lm is added, just as James explained to you already. > And I always thought gcc was -pedantic. I didn't realize it needed a > flag to make it even more so. gcc in default mode is remarkably forgiving, as long as you don't sin (or cos, or tan, or anything else math.h-y). -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-12-08 16:03 +0100 |
| Message-ID | <o2bskr$do3$1@dont-email.me> |
| In reply to | #98359 |
On 08/12/16 15:22, Richard Heathfield wrote: > On 08/12/16 14:13, Jerry Stuckle wrote: <snip> >> When they support multiple versions of the standard, they need to know >> which version of the standard to use. > > And so they require a switch, without which they are non-conforming to > any standard (or at least that's the case for gcc). > >> But -lm is a linker parameter, not compiler. > > Yes. Since we have been using the word "compiler" it's a reasonable > objection. Nevertheless, if we take the linker out of the equation, *no* > compiler is conforming, because to leave out the linker necessarily > means leaving out TP8! > > And if we put the linker back into the equation, gcc fails to conform > even when told to by -std=c??, unless the additional magic rune -lm is > added, just as James explained to you already. To add to the confusion of terminology, the "gcc" executable is not a compiler - it is a compiler driver, and (with a normal setup) will run the compiler, assembler and linker programs as needed. > >> And I always thought gcc was -pedantic. I didn't realize it needed a >> flag to make it even more so. > > gcc in default mode is remarkably forgiving, as long as you don't sin > (or cos, or tan, or anything else math.h-y). > If you have a target that has FPU opcodes for sinning, cossing (if only it were abbreviated "cus"...) and tanning, you may even get away without -lm.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-12-08 10:44 -0500 |
| Message-ID | <o2bv1i$lp0$1@jstuckle.eternal-september.org> |
| In reply to | #98359 |
On 12/8/2016 9:22 AM, Richard Heathfield wrote: > On 08/12/16 14:13, Jerry Stuckle wrote: >> On 12/7/2016 6:33 PM, jameskuyper@verizon.net wrote: >>> On Wednesday, December 7, 2016 at 3:13:27 PM UTC-5, Jerry Stuckle wrote: >>>> On 12/7/2016 12:40 PM, Keith Thompson wrote: >>> ... >>>>> Most C compilers are not conforming by default, and require some added >>>>> options to make them (atte >>> I >>>>> >>>> >>>> Why do you say that? There is nothing that says a compiler can't add >>>> features, as long as it does everything the standard says it does. >>> >>> ... and doesn't do anything the standard says is shouldn't do. >>> However, it >>> turns out that most compilers do in fact fail to do something >>> required by the >>> standard, or do something prohibited by the standard, when invoked in >>> their >>> default mode. The compilers I've used most frequently over the past >>> couple of >>> decades all take an -ansi option that puts them in C90 mode; without >>> that option, they don't fully conform to any version of the C >>> standard. Most of >>> them also require the -lm option to correctly handle code that uses >>> <math.h>, >>> and gcc also requires -pedantic. There was an extended discussion of >>> this issue >>> a few years ago in this newsgroup. In the end, only two very obscure >>> compilers >>> were identified that supposedly fully conformed in their default mode >>> - and >>> given how obscure they were, that conclusion might have simply been >>> the result >>> of nobody being aware of the the ways that they failed to conform. >>> >> >> When they support multiple versions of the standard, they need to know >> which version of the standard to use. > > And so they require a switch, without which they are non-conforming to > any standard (or at least that's the case for gcc). > >> But -lm is a linker parameter, not compiler. > > Yes. Since we have been using the word "compiler" it's a reasonable > objection. Nevertheless, if we take the linker out of the equation, *no* > compiler is conforming, because to leave out the linker necessarily > means leaving out TP8! > > And if we put the linker back into the equation, gcc fails to conform > even when told to by -std=c??, unless the additional magic rune -lm is > added, just as James explained to you already. > The C standard doesn't say anything about the linker (although it does extensively discuss linkage) or how libraries are linked in. But I would guess the reason for the -lm flag would be you might want to use libm, or you might have another library you want for the math functions. But I didn't write the compiler, so I don't know what they were thinking. >> And I always thought gcc was -pedantic. I didn't realize it needed a >> flag to make it even more so. > > gcc in default mode is remarkably forgiving, as long as you don't sin > (or cos, or tan, or anything else math.h-y). > Yes, sometimes too forgiving. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2016-12-08 15:48 +0000 |
| Message-ID | <o2bvcs$kqb$1@news.albasani.net> |
| In reply to | #98372 |
On 2016-12-08, Jerry Stuckle <jstucklex@attglobal.net> wrote: >> >> Yes. Since we have been using the word "compiler" it's a reasonable >> objection. Nevertheless, if we take the linker out of the equation, *no* >> compiler is conforming, because to leave out the linker necessarily >> means leaving out TP8! >> >> And if we put the linker back into the equation, gcc fails to conform >> even when told to by -std=c??, unless the additional magic rune -lm is >> added, just as James explained to you already. >> > > The C standard doesn't say anything about the linker (although it does > extensively discuss linkage) or how libraries are linked in. But I > would guess the reason for the -lm flag would be you might want to use > libm, or you might have another library you want for the math functions. > But I didn't write the compiler, so I don't know what they were thinking. gcc is used as linker frontend even for assembler programs. When libc is needed. Lot of assembler examples assume gcc as linker front end. -- press any key to continue or any other to quit
[toc] | [prev] | [next] | [standalone]
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
Back to top | Article view | comp.lang.c
csiph-web