Re: Requesting advice how to clean up C code for validating string represents integer
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Mon, 19 Feb 2007 15:23:14 -0800
rem642b@xxxxxxxxx (robert maas, see http://tinyurl.com/uh3t) writes:
From: Keith Thompson <k...@xxxxxxx>
GNU C is the C-like language accepted by gcc. It's very similar
to standard C, but has a number of extensions, some of which
violate the C standard.
Do you happen to know if there's a complete list of such violations
online in accessible format (plain text or simple HTML)? I'd like
to consult such a list as I develop my cookbook/matrix.
I don't know. gcc comes with extensive documentation, including a
section on gcc extensions. Its behavior on encountering a user of
such an extension depends on the command-line options. If it issues a
diagnostic (even just a warning) for anything that's a syntax error or
constraint violation in ISO C, that's probably enough for conformance.
Any gcc-specific questions not answered by the documentation should be
directed to gnu.gcc.help.
Note that gcc is a compiler, not a complete implementation; the C
runtime library is provided separately, and varies from one
platform to another. There is a GNU C library (separate from, but
usable with, gcc).
Yes, I understand that. Presumably if you compile a c program with
gcc, and specify the generic names of the headers for the various
libraries, for example:
#include <stdlib.h>
rather than specifying the actual path to the header to library, for example:
#include "/usr/local/bin/ansi/c/stdlib.h"
and you don't use a switch such as -ansi that forces gcc to use the
ansi instead of gnu version, then gcc will automatically arrange
that you get the GNU C version of each library rather than the ANSI
version. (Correct me if I'm wrong on this point!)
That's a gcc implementation detail, not a C language issue. <OT>The
gcc installation process creates modified versions of some of the
header files that already exist on the OS; the details are
off-topic.</OT>
And what exactly do you mean by "ANSI"? The current official C
standard, C99, was issued by ISO (and later adopted by ANSI). The
previous standard, which is still in wide use, is C90, also issued by
ISO (and adopted by ANSI). I suggest avoiding the use of "ANSI" as an
adjective; many people still use "ANSI C" to refer to the language
defined by the ANSI C89 and ISO C90 standard documents, but strictly
speaking that usage is incorrect. If you instead refer to "C90" or
"C99", you avoid the ambiguity.
When I have line that looks like this:
<li>GNU-c (#include <stdlib.h>) -- <em>mumble(x,y)</em></li>
I mean to imply that the function mumble is defined in the GNU C
version of the stdlib library but not in the corresponding ANSI
version of that same-name library. If I make a mistake in such
annotation, feel free to correct me.
On the web page, I saw, there were two functions marked "GNU-c", both
of them incorrectly. Both functions are defined by C99, but not by
C90.
<OT>
The phrase "the GNU C version of the stdlib library" doesn't make much
sense, unless you're referring to glibc. I use gcc on Linux, where
the C runtime library is glibc. I also use gcc on Solaris, where the
C runtime library is the one provided by Solaris. gcc is a compiler,
not a complete implementation.
</OT>
I'm thinking of changing my notation. Instead of saying "GNU-c" as
the language as I do there, instead just say "c", but have a
footnote that explains the situation regarding GNU vs. ANSI. I'll
be thinking more about it later today and maybe start updating the
file as soon as I have decided how exactly do do it.
[...]
I had the impression they were not in original c but are in GNU c,
so that was the distinction I was making. But if they're in C99 as
you claim, then I'd rather change that to show they're in C99
(instead of GNU c) but not in original c.
Be careful with the term "original c" (or, preferably, "original C").
Versions of C existed long before the first ANSI standard.
Is the C99 standard online in searchable/HTML format, for free, so
that I could consult it to verify fine points like this instead of
just taking your word for it? And are you referring to ANSI C99 or
ISO C99 anyway??
n1124.pdf, referenced above, is the C99 standard with two Technical
Corrigenda merged into it. Any post-C99 chanages are marked with
change bars.
<http://en.wikipedia.org/wiki/C_(programming_language)#C99>
publication of ISO 9899:1999 in 1999. This standard is commonly
referred to as "C99." It was adopted as an ANSI standard in March
2000.
That's not clear whether it's both an ISO standard and ANSI
standard, from the same document, or an ISO document but only an
ANSI standard.
I have no idea what you're asking.
[snip]
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: Roland Pibinger
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: robert maas, see http://tinyurl.com/uh3t
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: Racaille
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: robert maas, see http://tinyurl.com/uh3t
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: Yevgen Muntyan
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: Keith Thompson
- Re: Requesting advice how to clean up C code for validating string represents integer
- From: robert maas, see http://tinyurl.com/uh3t
- Re: Requesting advice how to clean up C code for validating string represents integer
- Prev by Date: Re: Difference between the stack and the heap?
- Next by Date: Re: How the stack grows
- Previous by thread: Re: Requesting advice how to clean up C code for validating string represents integer
- Next by thread: Re: Requesting advice how to clean up C code for validating string represents integer
- Index(es):
Relevant Pages
|
|