Re: A Problem With GD



robic0 schrob:
On Wed, 15 Mar 2006 10:37:30 +0100,
"Tassilo v. Parseval" <tassilo.von.parseval@xxxxxxxxxxxxxx> wrote:

Also sprach robic0:

For instance, long, short and byte are macro's.

As to all I know, this is utter nonsense. Do you have any documents
backing up that 'short' and 'long' are macros?

Really? What does a compiler know? It knows the smallest and the largest.
The smallest is always a "char", the largest is always an "int".

Wrong. The smallest addressable unit is always a char, but long int or
long long int are often larger than int.

Int is the largest bit representation of a native compiler that it knows
about of the largest data register that it is designed to work with.

"Native compilers" are irrelevant. I'm talking about C. A C
implementation isn't required to use something called "registers".

Albeit the data register must be "at least" as big.
So what is a "short", is it half the "int"? How many bits is that?
Is a "short" half of the "int"? Nope, its not!

Irrelevant.

In your mind, a "short" is 16 bits.

No.

Thats 1/4 of an "int" in a 64 bit
compiler.

Wrong. Many 64-bit compilers have 32-bit ints (for backwards
compatibility with broken programs). This also disproves your claim that
"int" corresponds to the largest data register of the underlying
machine.

Thats why "short" is a macro as well as byte (which has been
a macro almost since it was named).

"short" can't be a macro, and "byte" isn't standard C(++). Oh, and typedefs
aren't macros ("short" can't be a typedef either).

Macros controlled by either differently
named "extra-short-short" or whatever.

I don't understand that part.

Start a short C++ program in VC6 and use the type "short" and "byte"
and "long" then trace the definition. It leads to a MACRO!

Impossible. VC6 isn't a C++ compiler; the language it translates shares
a common subset with C++, but that's all. Besides, how do you "trace the
definition" for things like

long x;
long int y;
int long z;
long double f;
double long g;

? They're all valid C++. I'd like to see a macro implementation of
"long" that supports this.

There is only char and int, the min and max. All others are NOT TYPED
anymore for years!!! They translate into these two.

Definitely wrong. void, signed char, unsigned char, char, short,
unsigned short, int, unsigned int, long, unsigned long, float, double
and long double are all distinct types.

HTH, Lukas
.



Relevant Pages

  • Re: Replacing fgets
    ... Even if u_int8_t is a typedef for unsigned char, ... Didn't your compiler complain here. ... offset is changed ... offset needs to be an int. ...
    (comp.lang.c)
  • Re: How to use a C++ class in .NET
    ... > absolutely compiler dependant. ... > public ref class MyClass ... > int funtion1(unsigned char* inBuffer, unsigned inType, unsigned char* ...
    (microsoft.public.dotnet.framework)
  • Re: How to use a C++ class in .NET
    ... absolutely compiler dependant. ... public ref class MyClass ... int funtion1(unsigned char* inBuffer, unsigned inType, unsigned char* ...
    (microsoft.public.dotnet.framework)
  • Re: some advice
    ... It seems too I copy most of these macro ... I commenti su line che iniziano (dopo eventuali ... char *nome_file; ... int catstr ...
    (alt.lang.asm)
  • Re: querry related to structure padding
    ... char B; ... The compiler is still free to insert padding between B and C, ...
    (comp.lang.c)