cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/23/01:15:41

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Program Crashes!!! Please help! Memory errors!!!
Date: Mon, 22 Jun 1998 21:58:38 -0700
Organization: Alcyone Systems
Lines: 46
Message-ID: <358F35FE.7E80050C@alcyone.com>
References: <358e8ecb DOT 0 AT news2 DOT ibm DOT net> <358F2A21 DOT 525A5F2F AT cs DOT com>
NNTP-Posting-Host: kamali.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John M. Aldrich wrote:

>  - There should be no space after the # in a preprocessor directive.

Not true:

    The only white-space characters that shall appear between
    preprocessing tokens within a preprocesing directive (from just
    after the introducing # preprocessing token through just before the
    terminating new-line character) are space and horizontal-tab
    (including spaces that have replaced comments or possibly other
    white-space characters in translation phase 3) (ANSI 6.8).

In other words, spaces and tabs are perfectly valid between the # and
the preprocessing directive.  The following code fragment is strictly
conforming (whether or not you include the typographical indentation or
not):

    #if !defined(PLATFORM)
    #    error no platform defined!
    #endif

>  - In a for loop that goes from 0 to n-1, the clearest statement is
> thus:
> 
>    for ( int i = 0; i < num; i++ )
> 
>    not
> 
>    for ( int i = 0; i <= num - 1; i++ )

They are both correct; the first is merely more common than the second.

>  - Always compile programs with at least the flags '-Wall' and '-O';
> the
> compiler can catch lots of mistakes if you let it.

The optimization flag -O will catch more mistakes?

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm:+37.20.07/-121.53.38
                                     \
                   Regret it? nope. / Said it? yep.
                                   / Ice Cube

- Raw text -


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