sizeof() confusion
    Doug Gwyn 
    gwyn at smoke.brl.mil
       
    Wed Nov  7 22:38:58 AEST 1990
    
    
  
In article <9156 at latcs1.oz.au> jacob at latcs1.oz.au (Jacob L. Cybulski) writes:
>typedef unsigned char Pattern[8];
>void foo (Pattern x)
Pattern is an array of 8 chars.  x is a pointer to a char.  This is the
way C has been for years.
>The intuition says that sizeof(Pattern) = sizeof(x) regardless of the
>Pattern definition.
Why are you relying on intuition rather than the language definition?
>Now is it the fault of my compiler (THINK C) to give me such a hard time,
>is it my bad C programming style, or is it the ANSI standard which has some
>gaping semantic holes?
I think the problem is your intuition.  THINK C is producing correct results.
    
    
More information about the Comp.lang.c
mailing list