🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #46450

Re: Free reliable wordcount utility available (final version)

#46450
From: Benjamin Goldberg
Date: Wed, 06 Nov 2002 20:08
99 lines
5400 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.. Why is this option in the compiler and not
> in the linker?

Because it's the compiler which understands language syntax.

The linker only knows about libraries and object files... it doesn't
really care much about what's in them.

> 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. 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.

The file values.h is a header.  It is not a language extention.

The -A flag only makes gcc complain about language extentions.

If you want gcc to complain about non-ANSI headers, go find another
flag.

Does gcc have a "-ansi" flag?

> 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.
> 
> > 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.
> What is 't'? Some variable? You can't define variables at any position
> you like in ANSI-C AFAIK, that is C++.

You can declare variables at the beginning of a block.  Note the ({})
construct has a pair of {} in it?  So what you've got, is a block with a
pair of parenthesis around it, and a cast in front of those parens.

In other words, gcc allows you to use a block in a place where you would
normally only be allowed an expression.  Vaguely like 'do BLOCK' in the
perl programming language.

> > Also, the use of '//' comments in C code is a non-ansi extention
> > which gcc allows, if you don't use the '-A' flag.
> 
> I think Turbo C allows them too. But I have no real use for them. They
> only allow my comments to be three characters longer and I'll just
> wrap my comments (I think comments are more important than good
> efficient code at times).

Better to say, maintainable code is often more important than efficient
code -- and comments are merely one part of making your code
maintainable.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
.."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
Technical Details
Message-ID: <3DC976DA.32815A18@earthlink.net>
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!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!dialup-63.210.213.165.dial1.newyork1.level3.NET!not-for-mail
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>

Show Full Headers
Complete Article Headers
Message-ID: <3DC976DA.32815A18@earthlink.net>
Subject: Re: Free reliable wordcount utility available (final version)
Date: Wed, 06 Nov 2002 15:08:58 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
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!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!dialup-63.210.213.165.dial1.newyork1.level3.NET!not-for-mail
Newsgroups: alt.privacy.anon-server,sci.crypt,alt.fan.cult-dead-cow,alt.security.pgp
Lines: 99
NNTP-Posting-Host: dialup-63.210.213.165.dial1.newyork1.level3.net (63.210.213.165)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: fu-berlin.de 1036612949 9010286 63.210.213.165 (16 [87109])
X-Mailer: Mozilla 4.04 [en] (Win95; I)