delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/09/18:45:48

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: printf bug ???
Date: Tue, 09 Jun 1998 18:33:41 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 20
Message-ID: <357DB845.CDA12E28@cs.com>
References: <Pine DOT GSO DOT 3 DOT 96 DOT 980605144528 DOT 10548A-100000 AT bert DOT eecs DOT uic DOT edu>
<35784F8A DOT AB5D79CC AT gpu DOT srv DOT ualberta DOT ca> <MYoEcGATNFe1Ewts AT talula DOT demon DOT co DOT uk> <35789F02 DOT 1EF059F7 AT alcyone DOT com>
NNTP-Posting-Host: ppp107.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Erik Max Francis wrote:
> 
>     *p++ = getchar(s);
> 
> are undefined.  "Undefined," by the ANSI standard, means that _no_
> restrictions are imposed -- crashing or emailing the President of the
> United States is perfectly ANSI compliant.

Slight modification here:  that last expression _is_ defined, because p
is postfix-incremented only once in the entire expression.  The return
value from getchar() will be stored in *p, and then p will be
incremented.  Also, getchar() doesn't take any parameters.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Autocracy is based on the assumption|
|       aka Fighteer I       | that one man is wiser than a million |
|   mailto:fighteer AT cs DOT com   | men.  Let's play that over again,    |
| http://www.cs.com/fighteer | too.  Who decides?"   - Lazarus Long |
---------------------------------------------------------------------

- Raw text -


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