Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 28th, 2008, 12:09 AM   #11
Sorrofix
Expert Bug Developer
 
Sorrofix's Avatar
 
Join Date: Apr 2008
Posts: 22
Rep Power: 0 Sorrofix is on a distinguished road
Re: Can someone tell me?

Quote:
Originally Posted by Goblin View Post
c99 allows declaring variables in for loops
I didn't see anywhere that Chem.E had to use c89.For production code I would agree that following c89 would maximize portability but MinGW has pretty good c99 support for stuff like that.
D'oh! I meant C89; I forgot to say it. Let me try to clarify: I recommend following the C89 model, even if you're using a C99-capable compiler. You're not really sacrificing anything, and in return you ensure that your code compiles with the widest variety of C compilers (even if that doesn't seem useful right now, it could, further down the road).
Sorrofix is offline   Reply With Quote
Old Aug 28th, 2008, 6:39 AM   #12
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,254
Rep Power: 5 grumpy will become famous soon enough
Re: Can someone tell me?

Quote:
Originally Posted by Sorrofix View Post
D'oh! I meant C89; I forgot to say it. Let me try to clarify: I recommend following the C89 model, even if you're using a C99-capable compiler. You're not really sacrificing anything, and in return you ensure that your code compiles with the widest variety of C compilers (even if that doesn't seem useful right now, it could, further down the road).
You're right, but the practical benefits are minimal, so I'd suggest this is a moot point.

In practice, the majority of C89 compilers since 1994 or so have also been C++ compilers by default (the C++ support has to be explicitly disabled by command line options, or other explicit settings). And C++, in draft standards and therefore in compilers at the time, supported declaration of variables in for() constructs well before then.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC