Article View: alt.privacy.anon-server
Article #46486Re: Free reliable wordcount utility available (final version)
From: Richard Heathfield
Date: Wed, 06 Nov 2002 21:48
Date: Wed, 06 Nov 2002 21:48
119 lines
5677 bytes
5677 bytes
"Thomas J. Boschloo" wrote:
>
> Benjamin Goldberg wrote:
> >
> > Thomas J. Boschloo wrote:
> > [snip]
> > > > >> Anyways there will be a port to ANSI-C because I used
> > > > >> the wrong library for the maximum value of an integer and my
> > > > >> Turbo C 2.0 compiler didn't warn me at all about this (I should
> > > > >> have used INT_MAX from limits.h instead of MAXINT from values.h).
> > > > >
> > > > > Headers are headers. Libraries are libraries. Please learn the
> > > > > simple stuff before you move onto the complicated stuff. Thank
> > > > > you.
> > >
> > > So what does this compiler option tell you?
> > > -A disable non-ANSI extensions
> >
> > Headers are headers, libraries are libraries, and gcc extentions to the
> > language's syntax are, well, non-ANSI extentions. The -A option only
> > disables the last, it does not disable non-ANSI headers or libraries.
>
> So suppose you are right..
He is.
> Why is this option in the compiler and not in
> the linker?
You'd have to ask Borland that.
> Turbo C 2.01 has a special parameter to pass options to the
> linker (-l). I know some unix compilers are total trash, but I just
> didn't expect Turbo C to behave like this.
It isn't doing anything wrong. It would be a poor compiler that didn't
allow you to create and include your own header files, or that diagnosed
them if you did.
> Turbo C has a lot of
> extensions that are only valid for MS-Dos. Like a really good graphics
> library (a lot of games of those days used them for EGA graphics). These
> are also non-ANSI extensions. values.h is also non-ANSI, so the compiler
> should have complained about me including it.
Nope. Read the Standard, and you'll find that the compiler is under no
such obligation.
> Forgive me, but I am just a very messy and dyslectic coder. I do *need*
> a compiler that gives many, many warnings and errors. Turbo C does this
> a lot better than the compiler we used at the VU for coding modules for
> Minix.
It is indeed a very good compiler, albeit a rather old one.
> > Before you ask what extentions to C that gcc supports, and example would
> > be using blocks as rvalues... for example, consider code like the
> > following:
>
> I don't care about them. I just want lots of warnings if I do use them
> by accident. (I learned Turbo C before I even learned about even the
> existance of ANSI-C, also, I hadn't been coding in it for some years.
> Last thing I coded was a savegame editor for UFO Enemy Unknown by
> Microprose, 1998 I think).
>
> > extern void func( int * x );
> > #define FUNC() (int)({ int t; func(&t); t; })
> >
> > ....
> > int z = FUNC();
> > other_function( FUNC() );
>
> This looks flawed to me, but probably you are doing something clever.
He's showing you a gcc extension, to demonstrate the kind of things that
a compiler must diagnose if it is invoked in conforming mode (i.e. if
"extensions are disabled").
> What is 't'? Some variable? You can't define variables at any position
> you like in ANSI-C AFAIK, that is C++.
ANSI C has always supported the definition of objects at "block scope":
#include <stdio.h>
int main(void)
{
int i;
for(i = 1; i < 10; i++)
{
int j; /* LEGAL */
j = rand() / i;
printf("%d\n", j);
}
return 0;
}
A couple of years ago, ANSI adopted ISO/IEC 9899:1999 as the ANSI C
Standard. That update to the Standard introduced support for C++-style
"define it almost anywhere you like" positioning of definitions.
> > Also, the use of '//' comments in C code is a non-ansi extention which
> > gcc allows, if you don't use the '-A' flag.
Benjamin is half-right here. As of the revised Standard, BCPL-style //
comments have been introduced into ISO (and thus ANSI) C. IMHO they are
more trouble than they are worth, not least because they suffer from
line-wrap problems in Usenet.
<snip>
--
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Technical Details
Message-ID:
<3DC98E33.95681CDD@eton.powernet.co.uk>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!peer1.news.newnet.co.uk!lon1-news.nildram.net!195.60.31.14.MISMATCH!news2.power.net.uk!news.power.net.ukReferences:
<3DC1596C.6D2B55BD@hccnet.nl.invalid> <3DC526FC.CBCFE9B6@hccnet.nl.invalid> <3DC5451F.DBF3CDDA@eton.powernet.co.uk> <pan.2002.11.03.17.05.02.482162@yahoo.co.uk> <3DC81975.45915377@hccnet.nl.invalid> <3DC85EA2.2C8E26DA@earthlink.net> <3DC95533.512AB0A3@hccnet.nl.invalid>Show Full Headers
Complete Article Headers
Message-ID: <3DC98E33.95681CDD@eton.powernet.co.uk> Subject: Re: Free reliable wordcount utility available (final version) Date: Wed, 06 Nov 2002 21:48:35 +0000 From: Richard Heathfield <binary@eton.powernet.co.uk> References: <3DC1596C.6D2B55BD@hccnet.nl.invalid> <3DC526FC.CBCFE9B6@hccnet.nl.invalid> <3DC5451F.DBF3CDDA@eton.powernet.co.uk> <pan.2002.11.03.17.05.02.482162@yahoo.co.uk> <3DC81975.45915377@hccnet.nl.invalid> <3DC85EA2.2C8E26DA@earthlink.net> <3DC95533.512AB0A3@hccnet.nl.invalid> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.security.pgp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!peer1.news.newnet.co.uk!lon1-news.nildram.net!195.60.31.14.MISMATCH!news2.power.net.uk!news.power.net.uk Organization: Eton Computer Systems Ltd X-Mailer: Mozilla 4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (WinNT; I) X-Accept-Language: en-GB,en MIME-Version: 1.0 Newsgroups: alt.privacy.anon-server,sci.crypt,alt.fan.cult-dead-cow,alt.security.pgp Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 195.60.5.47 X-Trace: news.power.net.uk 1036620367 195.60.5.47 (6 Nov 2002 22:06:07 GMT) Lines: 120