www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/22/15:35:50

Xref: news2.mv.net comp.os.msdos.djgpp:5269
From: robert DOT fremin AT mailbox DOT swipnet DOT se (Robert Fremin)
Newsgroups: comp.os.msdos.djgpp
Subject: Does DJGPP conform to ANSI-C standards with the for () ?
Date: Sat, 22 Jun 1996 16:13:10 GMT
Organization: -
Lines: 66
Message-ID: <31cc17cd.1361371@nntpserver.swip.net>
NNTP-Posting-Host: dialup103-2-8.swipnet.se
NNTP-Posting-User: 41e1c758e329b31c4d905147051ba029
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I had great difficulties to compile this code (example):

void main()
{
	for (int i=0; i<100; i++);
}

All I got was errors, i not initialized it said.
I tried to move it out to...

void main()
{
	int i;
	for (i=0; i<100; i++);
}

....but all the same.

It only worked when I (at last) put the i globally.

int i;
void main()
{
	for (i=0; i<100; i++);
}

Is this really the right way? The code will be very messy this way,
and since I'm working on moving my code from Turbo-C to DJGPP, these
minor details really takes lots of my time to find.
It's messy enough with the DJASM variables to be global, forcing the
variables to have strange names.

When I make this function:

void PutPixel(int xpos, int ypos, char col)
{
	asm("
		...
	");
}

all references must be double (they must be global) so I have to make it:

int xpos, ypos;
char col;

void PutPixel(int xpos_, int ypos_, char col_)
{
	xpos = xpos_;
	ypos = ypos_;
	col = col_;

	asm("
		...
	");
}

and the global ones can be used also for GetPixel() or something...

What makes DJGPP unable to use local variables in for() and asm("") ?
Someone?


--- Robert Fremin -----------------------------------
--- http://bip.concept.se/user/sprite/hemsida.htm ---
-----------------------------------------------------

- Raw text -


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