Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old June 14, 2007, 17:20   #1
CJNyfalt
Swordsman
 
Join Date: May 2007
Posts: 289
CJNyfalt is on a distinguished road
C99 and Angband?

I have noticed that the latest development Angband code uses C99 features.

Now, I like the new features available in C99, but how common are compilers that support them? Does C++ compilers in general support C99 features?
CJNyfalt is offline   Reply With Quote
Old June 14, 2007, 18:22   #2
Psi
Knight
 
Join Date: Apr 2007
Location: Surrey, UK
Age: 44
Posts: 870
Psi is on a distinguished road
The free WinCE 4.0 compiler certainly doesn't - can't comment on Visual Studio.
Psi is offline   Reply With Quote
Old June 14, 2007, 18:42   #3
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,946
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by CJNyfalt View Post
I have noticed that the latest development Angband code uses C99 features.

Now, I like the new features available in C99, but how common are compilers that support them? Does C++ compilers in general support C99 features?
The current code should not (it did for a while, though). All code in the trunk should compile under an ISO C89 mode. We do make use of various useful C99 headers if they're around, though, for guaranteed type sizes and the like.
takkaria is offline   Reply With Quote
Old June 14, 2007, 18:55   #4
CJNyfalt
Swordsman
 
Join Date: May 2007
Posts: 289
CJNyfalt is on a distinguished road
Quote:
Originally Posted by takkaria View Post
The current code should not (it did for a while, though). All code in the trunk should compile under an ISO C89 mode. We do make use of various useful C99 headers if they're around, though, for guaranteed type sizes and the like.
It's not as much that I'm worried that it won't compile, and more about if it's safe to add new features from C99 in other places.
For example, z-form still needs sprintf, which is unsafe, under C89,
but C99 should have snprintf which is safer from buffer overflows.
If there's need to jump through hoops and add a big mess of ifdefs, then I would avoid C99 for the time being.
CJNyfalt is offline   Reply With Quote
Old June 14, 2007, 19:07   #5
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,946
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by CJNyfalt View Post
It's not as much that I'm worried that it won't compile, and more about if it's safe to add new features from C99 in other places.
For example, z-form still needs sprintf, which is unsafe, under C89,
but C99 should have snprintf which is safer from buffer overflows.
If there's need to jump through hoops and add a big mess of ifdefs, then I would avoid C99 for the time being.
I was planning to replace to use of sprintf with a builtin version, myself, to avoid using it.

There's a page with the current coding guidelines, BTW, in case you're interested:
http://ajps.mine.nu/angband/wiki/CodingGuidelines
takkaria is offline   Reply With Quote
Reply


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


All times are GMT +1. The time now is 18:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.