TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: Darin McBride
date: 1998-06-25 20:55:58
subject: Sleep()

> However, I'll leave it at that before someone accuses
 > me of showing a C++ bias again.  :-)

 BB>     That was because you initialised a list of 
 BB> variables at the time you declared them. You can't do 
 BB> that in C. You have to declare them all first, then 
 BB> initialise them. That is one place where C++ differs 
 BB> from C.

Bah...

1. The proposed next C standard allows this.
2. I never specified that the variables had to be right there.
3. If it was in a loop, as I would suspect, it would be fine:

int i;

/* ... */

for (i = 0; i < count; ++i)
{
  const int a = r[i]->blah;
  const short* p = s[a].typeid;
  fread(p, sizeof(*p), 1, f);
}

Perfectly valid ANSI-C89.

I didn't see any C++'ism there.


---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 670/213 218
@PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.