Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unbreak the build by pleasing the C90 Elder Gods, petdance--
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a mistake on my part, indeed. Mixing code and declarations is bad.
But we're not working entirely on C90 specs. If you run GCC with -pedantic on, there are plenty of other C90 errors in our code that we don't have a problem with.
Is this surprising? Do we think that we will build on any C90 compiler? What C90 compiler did the build break on?
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It broke the build on gcc (Ubuntu 4.4.3-4ubuntu5)
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's craziness. I'm running GCC as well. Can you point to the failed build? Would love to see what flags it was using.
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parrot's coding standard is C89/C90 (effectively the same language), see PDD 07. There are good reasons for defining and keeping coding standards (ease of maintenance, minimizing technical debt, etc...), petdance has given some excellent talks on the subject.
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping some agreed-upon set of standards is good. Our particular C90 requirement can probably be improved. I would love to bump up to C99 eventually.
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that the problem with this was that I was building under g++ and g++ is just fine with declarations after code. I need to make sure that I build under both before committing.
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C99 is definitely tempting. It's mainly a question of portability, particularly MSVC, which doesn't support the C99 standard (and apparently has no plans to ever).
5dbcdef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. msvc is pretty much the only reason we're not coding to a more modern version of C.