www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/30/13:31:18

From: "Thomas Jansen" <jansen AT cs DOT bonn DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to get file size?
Date: 30 Sep 1997 09:41:55 GMT
Organization: NDH Netzwerkdienste Hoeger
Lines: 25
Message-ID: <01bccd85$2792ae40$674e04c3@default>
References: <01bccc5b$8138ba00$0200a8c0 AT ingo> <343046B3 DOT 90B361A8 AT sr DOT flashnet DOT it>
NNTP-Posting-Host: port103.koeln.ndh.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> if  (*Pointer>Min_Ascii_code && *Pointer++<Max_ascii_code) Num_Char++;

uuuuuhhhhhh!
 
>  end of cycle.

if there is just one character that is < Min_Ascii_code, the "cycle" will
never end, because the *Pointer will never increase..

Is this so hard to understand? it's a common problem with the
"side-effects" in any (if-) clause! if the first argument of an
"&&"-statement doesn't fit (is NOT true), the whole statement can't be
true, and thus the second argument won't be "executed"! it's the same with
the "||"-statement (if the first is true, the statement is always true, and
thus the second argument won't be "executed", too..

this means for your example, if the first part in your if-clause is not
true (*Pointer <= Min_Ascii_code) the compiler never executes the second
part, and thus, never increases the pointer (*Pointer++).. and yo you'll
always check the same char which will never fit!

> Seby.

greets, thomas...

- Raw text -


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