|
The -pedantic compiler flag. |
AMCerasoli
Member #11,955
May 2010
|
Man I couldn't stop laughing when I activated the -pedantic flag in MinGW and it gave me an error in the Allegro library, and I was like uh? what could it be? And when I saw the error... typedef enum ALLEGRO_FILE_MODE { ALLEGRO_FILEMODE_READ = 1, ALLEGRO_FILEMODE_WRITE = 1 << 1, ALLEGRO_FILEMODE_EXECUTE = 1 << 2, ALLEGRO_FILEMODE_HIDDEN = 1 << 3, ALLEGRO_FILEMODE_ISFILE = 1 << 4, ALLEGRO_FILEMODE_ISDIR = 1 << 5, // < -- This?... My god... } ALLEGRO_FILE_MODE;
4.6.2\include\allegro5\fshook.h|52|error: comma at end of enumerator list [-pedantic]| Hahahahaha Why the compiler is so strict sometimes and sometimes is not?
|
Thomas Fjellstrom
Member #476
June 2000
|
-pedantic really means what it says it means. It's there to be pedantic. Now add -ansi to the argument list and see how much it screams. -- |
AMCerasoli
Member #11,955
May 2010
|
Uh? it didn't gave me any errors with -ansi are you pulling my leg?
|
Thomas Fjellstrom
Member #476
June 2000
|
AMCerasoli said: Uh? it didn't gave me any errors with -ansi are you pulling my leg? That probably just means we've done a decent job with Allegro -ansi and -pedantic together usually lead to a lot of warnings and errors for projects. You are adding -Wall -Wextra right? -- |
AMCerasoli
Member #11,955
May 2010
|
Thomas Fjellstrom said: You are adding -Wall -Wextra right? No I had only -Wall, I have just added -Wextra but it's the same. Man why my compiler doesn't give me any errors? I want compilers errors. When I made the trivia game I didn't use none of this, and even not using them I had some warnings about variables being initialized first in the initialization list and problems with char and int being compared, but this time I want to let it everything crystal clear, since the project is going to be a lot bigger. My next videogame... Emancipation: A World Without Peace
Yay \o/
|
Thomas Fjellstrom
Member #476
June 2000
|
AMCerasoli said: No I had only -Wall, I have just added -Wextra but it's the same. Man why my compiler doesn't give me any errors? I want compilers errors. Write worse code. -- |
Peter Wang
Member #23
April 2000
|
Fixed, thanks.
|
AMCerasoli
Member #11,955
May 2010
|
Well I just put it here to let you know... There is another comma out there! be careful you can blow out your PC! enum ALLEGRO_MIXER_QUALITY { ALLEGRO_MIXER_QUALITY_POINT = 0x110, ALLEGRO_MIXER_QUALITY_LINEAR = 0x111, }; Allegro_audio.h I'm finding this while including the headers in my project... hoHOho.
|
Arthur Kalliokoski
Second in Command
February 2005
|
From the zlib FAQ (q 35) "Q: I get this or that compiler or source-code scanner warning when I crank it up to maximally-pedantic. Can't you guys write proper code? A: Many years ago, we gave up attempting to avoid warnings on every compiler in the universe. It just got to be a waste of time, and some compilers were downright silly. So now, we simply make sure that the code always works." They all watch too much MSNBC... they get ideas. |
AMCerasoli
Member #11,955
May 2010
|
They can say whatever they want, but if I find another comma out of place I will stop using Allegro, and that is my last word... 1//Arthurs Kalliokoski's code
2
3#include <lol.h>
4
5int main(){
6 enum Arthur_pepsi_packs{
7 MONDAY = 1000,
8 TUESDAY = 500,
9 WEDNESDAY = 000,
10 THURSDAY = 1000,
11 FRIDAY = 1500,
12 SATURDAY = 500,
13 SUNDAY = 000,
14 ,
15 ,
16 }
17
18 return 0;;;;;;;;;;;;;;;;;
19}
|
Arthur Kalliokoski
Second in Command
February 2005
|
There should be a for(;;) loop in there somewhere, and Wednesday's and Sunday's values are totally unacceptable. They all watch too much MSNBC... they get ideas. |
Peter Wang
Member #23
April 2000
|
AMCerasoli said: if I find another comma out of place I will stop using Allegro There were two more. Anyway, it's worth fixing these things in public headers because you never know where they will be included.
|
Bruce Perry
Member #270
April 2000
|
For consistency you need to keep all the numbers the same length: 1//Arthurs Kalliokoski's code
2
3#include <lol.h>
4
5int main(){
6 enum Arthur_pepsi_packs{
7 MONDAY = 1000,
8 TUESDAY = 0500,
9 WEDNESDAY = 0000,
10 THURSDAY = 1000,
11 FRIDAY = 1500,
12 SATURDAY = 0500,
13 SUNDAY = 0000,
14 ,
15 ,
16 }
17
18 return 0;;;;;;;;;;;;;;;;;
19}
-- |
Arthur Kalliokoski
Second in Command
February 2005
|
Are you forgetting that starting a number with a zero (but no x) means the compiler interprets it as octal? They all watch too much MSNBC... they get ideas. |
Bruce Perry
Member #270
April 2000
|
No, that's exactly why I 'corrected' the code -- |
|