|
This thread is locked; no one can reply to it. |
1
2
|
Difference between int main and int main void in allegro |
bamccaig
Member #7,536
July 2006
|
I like to explicitly declare void arguments. Just as I like to fully qualify instance members with this and class namespaces. There's nothing wrong with it. In fact, I'd argue that it's better. You're being more explicit about what you want. There's less chance of you making a mistake that way. Append: char * [] is the most correct type for argv AFAIK. I'm not sure if people were saying that doesn't work on OS X (for whatever stupid reason) or if those people are just used to char ** (there's little practical difference). -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Arthur Kalliokoski
Second in Command
February 2005
|
Thomas Fjellstrom said: Are return registers demanded by C, or is it implementation defined? Implementation defined, that's why he made that chart. [EDIT] Or maybe I should have said OS defined. They all watch too much MSNBC... they get ideas. |
Thomas Fjellstrom
Member #476
June 2000
|
In C you WANT to declare void arguments. In C++ it doesn't matter, but maybe makes it a bit clearer. Arthur Kalliokoski said: Implementation defined, that's why he made that chart. I see, good to know. So I assume most/all implementations for x86 do it that way? I would assume yes, just so they are somewhat compatible. -- |
Arthur Kalliokoski
Second in Command
February 2005
|
Thomas Fjellstrom said: So I assume most/all implementations for x86 do it that way? I would assume yes, just so they are somewhat compatible. Yes, although there are tons of other gotchas, such as Windows requiring prepended underscores on globals in the assembly code but not the C code, Linux has the "red zone" (although you can ignore that if you want) etc. They all watch too much MSNBC... they get ideas. |
Thomas Fjellstrom
Member #476
June 2000
|
Windows also has a different calling convention for some things. But I don't know if that affects the return. The underscore thing just just part of the object/binary spec. COFF demands an leading underscore. Even C compilers add the underscore in the compiled code. -- |
Arthur Kalliokoski
Second in Command
February 2005
|
{"name":"606547","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/d\/9d61580b64b73c2a6f341b02584456f0.png","w":1236,"h":1316,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/d\/9d61580b64b73c2a6f341b02584456f0"} They all watch too much MSNBC... they get ideas. |
|
1
2
|