This page contains errors that are based on conceptual misunderstandings of the programming environment or the compiler. Maybe you have seen some of this stuff already.
What you will see here:
Some of the #defines that are popular in the Windows and OS/2 environment seem
to dull programmers minds. Many programmers in this areas have a rough
understanding that they should use SHORT
or LONG
instead of just int
, since the former is portable and the
latter is not.
Working for a big company mentioned elsewhere in these pages, I detected many programs with a main function like this:
SHORT main(short argc, char* argv[]) { .... }
It is pure luck that this code works, since the only declarations for main() that are allowed according to the ISO standard are
int main (void) { /* ... */ }and
int main (int argc, char* argv []) { /* ... */ }
I asked one of the programmers, why he was using a short
instead of
an int
and got the answer that a short
is more
portable. I decided that it would be useless to discuss this aspect further, but
there is another interesting thing in this declaration. So I asked, why the
result of main() is declared as a SHORT
(upper case), whereas the
parameter is a short
(lower case). The answer was that there is no
difference between the two, because the compiler is not case sensitive...
Go back.