:: Re: [DNG] Why C/C++ ?
Pàgina inicial
Delete this message
Reply to this message
Autor: karl
Data:  
A: dng
Assumpte: Re: [DNG] Why C/C++ ?
Didier Kryn:
...
>     Yes, you think you learned it... but sometime you discover you
> missed something. And there's a lot one can miss in C. There's a lot of
> subtelties, like in automatic type promotion, for example, like the
> difference between static and automatic variables, static constants and
> automatic constants, embedded functions... And this horrible thing of
> using the equal sign for assignment:


Every language has their faults, if you start to complain about things
in the languages you are using you are just making it hard for yourself.
And yes there are many subtle things in C.

> When you write
>
> x = 1;
>
> ...
>
> x = 2;
>
>     Any one having a notion of mathematics will call you a liar.


No, this isn't prolog, and even the language for math, fortran, has
the equal sign for assignment as many others. And mathematicians
are used to "if we define ... then" stuff.
Every language has their own of doing things, just learn it or use
something else.
If you really cannot comply with = and ==, you can use something
like:

#define def =
#define eq ==

...
>     In C, INT_MAX+1 == -1   ( INT_MAX is defined in <limits.h>)

...

Well, no, INT_MAX+1 is a so called undefined behaviour, and don't
assume you are on a 2-complements machine. If you are programming
in this glorified assembler called c, you shell proceed with due
care.
And the compiler have been more responsive in reporting that kind
of stuff in later years, relieving some of theese stuff from the
programmers.

Regards,
/Karl Hammar