Forgot your password?
typodupeerror
Programming

The Perils of Developers Hooking Up 278

Posted by timothy
from the like-with-like-among-their-own-kind dept.
jammag writes "Who better for a developer to love than another developer? Yet as a veteran coder describes, it's not always a good idea for a programmer to fall for another programmer. He describes his experience observing — and getting partially pulled into — a romance within a development team. Part of the problem, perhaps, is that some developers spend so much time buried in code that, well, they quickly find themselves out of their league. Then again, why not love among the code?"

Comment: Re:fp (Score 1) 594

by jps25 (#40598105) Attached to: Objective-C Overtakes C++, But C Is Number One

The main in C and C++ differ.
The main in C in hosted environments has been either
int main(void) { /*...*/ } or
int main(int argc, char *argv[]) { /*...*/ }
since at least the C89 standard.
http://web.archive.org/web/20050207005628/http://dev.unicals.com/papers/c89-draft.html#2.1.2
C99/C11 Section 5.1.2.2.1
For freestanding environments the standard states that the name and type of the function called at program startup are implementation-defined.
So, yes void main() would be perfectly valid C if the freestanding environment requires it that way.
Obviously gcc doesn't have to support it or any freestanding environment.
I didn't imply it had to, I merely stated that gcc complains about one incorrect main in a hosted environment but not about another in a hosted environment.

The main in C++ in freestanding environments is, again, implementation-defined.
In hosted environments the main shall have a return type of int but its type is implementation-defined.
Any implementation must at least support
int main() { /*...*/ } and
int main(int argc, char *argv[]) { /*...*/ }
Has been like that since the C++98 standard, section 3.6.1.

In C int f(void) is a function with no parameters returning an int,
int f() is a function with no parameter specification returning an int.
They are not the same and should not be treated as such.

So, what we have is GCC supporting the standard, but whose implementation differs from other compilers. The devs made the choice to not support void main and that's perfectly fine. Nearly everybody who declares main as void are doing so in a hosted environment, and warnings/errors and completely justified.

No. What we have is gcc failing to support the most basic part of the C standard, rendering its -W flags at least questionable.
If it can't warn about an improper main, what else is it failing at?
All I really wanted to point out is that using some code and a compiler is no way to verify the standard.
I used main as an example because the OP wrote int main() in his "verification".

Comment: Re:fp (Score 1) 594

by jps25 (#40596825) Attached to: Objective-C Overtakes C++, But C Is Number One

And regarding the original discussion about uninitialised local variables I agreed with you. But that's because of the standard, not because of how gcc does things.
Regarding gcc's adherence to the standard I gave you the most basic example a compiler should get right but doesn't.
All I'm trying to tell you is that if you want to verify that something is according to the standard, then using a piece of code and a compiler is not the correct way to do it, especially since a compiler can do whatever it wants with all undefined and implementation defined behaviour in the standard.
gcc could have easily chosen to always initialise uninitialised local variables to 0 regardless of optimisations.

Comment: Re:fp (Score 1) 594

by jps25 (#40594585) Attached to: Objective-C Overtakes C++, But C Is Number One

No, you verified it well enough for gcc.
gcc complains about void main(), which is perfectly valid C in a freestanding environment, so why can't it complain about int main() in a hosted environment?
My best guess is that the gcc devs don't care about the difference between C and C++ mains because int main() is correct C++.
Or they don't know. Or they're just lazy. In any case, if gcc wasn't free and available, I doubt it'd be used as much.

Nothing ever becomes real until it is experienced. - John Keats

Working...