delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/09/03:22:59

Date: Wed, 9 Jul 1997 10:21:17 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Giovanni Resta <resta AT imc DOT pi DOT cnr DOT it>
cc: djgpp AT delorie DOT com
Subject: Re: void main ?
In-Reply-To: <resta-0707971133390001@mac-resta.imc.pi.cnr.it>
Message-ID: <Pine.SUN.3.91.970709101855.16266A-100000@is>
MIME-Version: 1.0

On Mon, 7 Jul 1997, Giovanni Resta wrote:

> This self-centered preamble just to stress that when I say that in the past 5
> years I used void main(), I mean that (1) now I use int main(), (2) 
> I completely agree that void main() is not correct with respect to ANSI/ISO
> standard, but that (3) I just wonder If anybody come out with an 
> actual example of an error caused (directly of indirectly) by void main().

IMHO, using ``void main()'' is playing with fire.  It's not a question
of specific examples, it's just good engineering.

ANSI standard is not just another document, compiler vendors usually
won't spare any effort to make their products be compliant.  Features
defined by the standard are first to be tested and scrutinized by
various test suites, and are thus likely to be bug-free.  If somebody
finds a bug that makes a compiler violate ANSI rules, it is quickly
fixed.

By contrast, when you use a non-standard technique and find a bug,
many vendors will tell you to get lost.  Some of them will even claim
it's a feature, not a bug.  Therefore, when you use non-standard
features, you have higher (sometimes, much higher) probability of
hitting compiler bugs which are difficult or even downright impossible
to work around.  I have tails from the trenches to tell from here to
eternity about my colleagues that complained about strange bugs in
non-ANSI features, which then miraculously disappeared when they took
my advice and rewrote the code to use ANSI features instead.  (Sometimes, 
all it took was to use an ANSI function instead of non-ANSI one.)

If you are to build a bridge, would you use parts, however bright they
shine, that don't comply to established reliability standards?  Or
would you rather settle for more mundane, but tested and certified
ones?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019