Hello, world! and programming languages

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
Eevee
Posts: 592
Joined: Wed Jul 16, 2003 5:26 am
Contact:

Post by Eevee »

Graf Zahl wrote:The biggest problem I am having with GCC is that it outputs TOO MANY warnings -even without -Wall.
sooo fix the warnings? :P at least if you write code aimed at VC++ and compile it with GCC you only get warnings; when I do the reverse VC++ explodes into a cloud of rather silly compile errors.
Graf Zahl wrote:There are still legal constructs in C which are illegal in C++.
o.o only thing that comes to mind is:

Code: Select all

int a;
a = 4 //**/2;
3;
Graf Zahl wrote:Why should I use an inferior version of practically the same programming language?
o.ó angry eyebrow.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Eevee wrote:
Graf Zahl wrote:The biggest problem I am having with GCC is that it outputs TOO MANY warnings -even without -Wall.
sooo fix the warnings? :P at least if you write code aimed at VC++ and compile it with GCC you only get warnings; when I do the reverse VC++ explodes into a cloud of rather silly compile errors.

That's because GCC is far too lax regarding its syntax checks. Combined with the bad habit of putting out warnings for certain errors it's totally annoying.
User avatar
Eevee
Posts: 592
Joined: Wed Jul 16, 2003 5:26 am
Contact:

Post by Eevee »

What's it lax about? And what errors? argh. the only difference coming to mind is that VC++ doesn't recognize the i in for (int i;;) to be local to that loop. and something about classes that I completely forgot.
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

Post by Cyb »

Eevee wrote: o.o only thing that comes to mind is:

Code: Select all

int a;
a = 4 //**/2;
3;
heh, actually most C compilers support // for comments (gcc among them) since using /**/ for everything is just annoying
User avatar
Chris
Posts: 2978
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

heh, actually most C compilers support // for comments (gcc among them) since using /**/ for everything is just annoying
That's right. But // wasn't valid C until C99, so in C, that code is a = 4 / 2; but in C++, it would be a = 4 3;

And you could always use -posix (if that's valid, or -ansi) with -pedantic if you're worried about compatibility with no warning flags. But in my experience, -Wall has never outputted a non-important warning (whether or not it was crucial is another matter). Sometimes -W can get annoying, especially if the code was initially written without it, but -Wall should almost always be heeded, in my experience.
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

Post by Cyb »

what kind of crazy doesn't use C99!?
User avatar
Chris
Posts: 2978
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

Not too many, since C99 is reletively new and runs into compatibility/implementation issues. Declaring variables anywhere within a code block is valid C99, but you still only see that in C++.
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

Post by Cyb »

yeah I know, but regardless most compilers support // for comments even without C99 flagged on (or whatever you do, I stick to ANSI myself when I code C, which I try not to do :P) because it's really just insane that there's no single line comment support for C. Default gcc settings on both SunOS and Linux allow this, so it must be some kind of standard (by contrast you still have to declare vars at the top of blocks, so it's not C99)
User avatar
Chris
Posts: 2978
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Post by Chris »

// In C is a GCC extention that any sane compiler just happens to support as well. By contrast, variable size arrays like this:

Code: Select all

int some_function(int blah)
{
  char some_string[blah];
  // blah blah..
}
has been a valid GCC extention, however most all other compilers, including MSVC, would choke on it immediately. But C99 standards now specify it (incidently, this is still invalid in C++).
User avatar
Raziel Anarki
Posts: 27
Joined: Thu Oct 30, 2003 9:38 pm

Post by Raziel Anarki »

Mista_T wrote:9 PAGES AND NO JAVA?!
well, 10 pages and no php either :wink:

Code: Select all

<?php

echo "Hello World";

?>
Cyb
Posts: 912
Joined: Tue Jul 15, 2003 5:12 pm

Post by Cyb »

Chris wrote:// In C is a GCC extention that any sane compiler just happens to support as well. By contrast, variable size arrays like this:

Code: Select all

int some_function(int blah)
{
  char some_string[blah];
  // blah blah..
}
has been a valid GCC extention, however most all other compilers, including MSVC, would choke on it immediately. But C99 standards now specify it (incidently, this is still invalid in C++).
waoh weird, I didn't know that was valid in C99, it's not even valid in C++ (yes I know you already said that heh)... that could come in handy, though it's just as easy to use malloc (I guess)... crazyness
Post Reply

Return to “General”