www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/15/10:57:16

From: fredex AT fcshome DOT stoneham DOT ma DOT us
Message-Id: <199606151114.HAA09131@fcshome.stoneham.ma.us>
Subject: Re: Is post-increment a pre-increment?
To: grendel AT ananke DOT amu DOT edu DOT pl (Mark Habersack)
Date: Sat, 15 Jun 1996 07:14:57 -0400 (EDT)
Cc: djgpp AT delorie DOT com
In-Reply-To: <Pine.NEB.3.93.960612212436.3438B-100000@ananke.amu.edu.pl> from "Mark Habersack" at Jun 12, 96 09:39:52 pm

Thinking furiously, Mark Habersack wrote:
>     default:
>       len += CharWidth(*walker++, curFont); // Here, the walker variable has
>                                               // been everytime incremented
>                                               // TWICE, not ONCE as it was
>                                               // meant to be - what is wrong?
>    }
> 
>  Later on I changed the offending line to
>    len += CharWidth(*walker, curFont);
>    walker++;
>  and everything worked just fine. Where lies the error - is it my ignorance or
> a bug or side effect?

Is CharWidth a macro? I so, it's probably referring to it's first parameter
two (or more) times, thereby causing the postincrement to happen multiple
times.

Fred
-- 
-------------------------------------------------------------------------------
 .----    Fred Smith    /                        Office: fred AT computrition DOT com 
( /__  ,__.   __   __ /  __   : /                                 508-663-2524 
 /    /  /   /__) /  /  /__) .+'           Home: fredex AT fcshome DOT stoneham DOT ma DOT us 
/    /  (__ (___ (__(_ (___ / :__                                 617-438-5471 
-------------------------------- Jude 1:24,25 ---------------------------------

- Raw text -


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