Mail Archives: djgpp/2001/12/28/01:20:46
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f
|
Message-ID: | <3C2C0B2C.C7ADCFF9@earthlink.net>
|
From: | Martin Ambuhl <mambuhl AT earthlink DOT net>
|
Organization: | Nocturnal Aviation
|
X-Mailer: | Mozilla 4.77 [en] (Win95; U)
|
X-Accept-Language: | en,de-CH,fr,ru,zh-CN,ja
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: DJGPP: #define problems
|
References: | <daed704d DOT 0112271423 DOT 309fcdeb AT posting DOT google DOT com>
|
Lines: | 56
|
Date: | Fri, 28 Dec 2001 06:03:39 GMT
|
NNTP-Posting-Host: | 165.247.43.230
|
X-Complaints-To: | abuse AT earthlink DOT net
|
X-Trace: | newsread1.prod.itd.earthlink.net 1009519419 165.247.43.230 (Thu, 27 Dec 2001 22:03:39 PST)
|
NNTP-Posting-Date: | Thu, 27 Dec 2001 22:03:39 PST
|
X-Received-Date: | Thu, 27 Dec 2001 22:03:39 PST (newsmaster1.prod.itd.earthlink.net)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Matt wrote:
>
> Hi All,
>
> I have am having a problem with the way #define's are being handled. I
> have some sample code to demonstrate the problem.
Your code is broken. See the following:
#include <stdio.h>
/* mha - your defines */
#define BASEVAL1 233
#define BASEVAL2 BASEVAL1 + 29
#define BASEVAL3 233
#define BASEVAL4 BASEVAL1 + 57
/* mha - my defines */
#define MHAVAL1 233
#define MHAVAL2 (MHAVAL1 + 29)
#define MHAVAL3 233
#define MHAVAL4 (MHAVAL1 + 57)
int main(void)
{
/* mha - code using your defines */
printf("baseval1 [233] = %d\n", BASEVAL1);
printf("baseval2 [262] = %d\n", BASEVAL2);
printf("baseval3 [233] = %d\n", BASEVAL3);
printf("baseval4 [290] = %d\n", BASEVAL4);
printf("baseval4 - baseval2 [28] = %d\n", BASEVAL4 - BASEVAL2);
printf("290 - 262 [28] = %d\n\n", 290 - 262);
/* mha - code using my defines */
printf("mhaval1 [233] = %d\n", MHAVAL1);
printf("mhaval2 [262] = %d\n", MHAVAL2);
printf("mhaval3 [233] = %d\n", MHAVAL3);
printf("mhaval4 [290] = %d\n", MHAVAL4);
printf("mhaval4 - mhaval2 [28] = %d\n", MHAVAL4 - MHAVAL2);
printf("290 - 262 [28] = %d\n\n", 290 - 262);
return 0;
}
baseval1 [233] = 233
baseval2 [262] = 262
baseval3 [233] = 233
baseval4 [290] = 290
baseval4 - baseval2 [28] = 86
290 - 262 [28] = 28
mhaval1 [233] = 233
mhaval2 [262] = 262
mhaval3 [233] = 233
mhaval4 [290] = 290
mhaval4 - mhaval2 [28] = 28
290 - 262 [28] = 28
- Raw text -