+3  A: 

ISO C is the C standard. The current one is C99 but C1x is right around the corner. If by rapid, you mean a new standard every decade or so, then yes, it is rapidly evolving :-)

Section 6.5.3.4/3 of ISO C99 states:

When applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1.

When applied to an operand that has array type, the result is the total number of bytes in the array.

paxdiablo
A: 

For arrays, the sizeof returns the total size. Be careful about arrays passed as pointers.

C99 standard:

When applied to an operand that has array type, the result is the total number of bytes in the array

Let_Me_Be
+6  A: 

Or just microsoft's C is not ISO C but some other standard C (if there exists any).

Microsoft Visual C still supports C89 [only] whereas other compilers like gcc/clang etc support C99 too which is the current Standard.

C99 [Section 6.5.17/2] says

The left operand of a comma operator is evaluated as a void expression; there is a sequence point after its evaluation. Then the right operand is evaluated; the result has its type and value.95

Thus the result of sizeof (0,arr) would be sizeof(char*)[due to the implicit lvalue to rvalue conversion /automatic decay to pointer type] not 100*sizeof(char)

sizeof(arr) would have given 100*sizeof(char) from 6.5.3.4/3

95) A comma operator does not yield an lvalue.


decided that this would be another solution to the above problem, which I tried on Microsoft Visual Studio 2008, but regardless of whether it is compiled as C or C++ code sizeof(0, arr) always yields 4.

C++03 [5.18/1] Comma Operator

The type and value of the result are the type and value of the right operand; the result is an lvalue if its right operand is.

So sizeof(0, arr) = sizeof (arr) and which would be equal to 100* sizeof(char) and not = sizeof(char*).

So MSVC++ is giving incorrect result (in case of C++ code).

Prasoon Saurav
@Prasoon: does the 95) refer to C or C++?
Armen Tsirunyan
@Armen : `C99` [..] Edited my post for clarity.
Prasoon Saurav
Sometimes I wonder why I am still using MSVC. But then they have an awesome IDE...
Armen Tsirunyan
@Armen : Yeah right! But the compiler is broken and has no C99 support yet. Bad! Bad! Bad! `:(`
Prasoon Saurav
@ Prasoon: Their compiler is undoubtedly horrible (from a pedantic point of view), but their IDE is the best. A natural question arises... isn't it possible to integrate Comeau or g++ compiler with MSVS IDE? I smell a new thread :)
Armen Tsirunyan
I have never tried that but I don't think that's **im** possible. Any MS guy out there? Haha!
Prasoon Saurav
@Prasoon which arises one more question. Where ARE the MS guys? I mean there are zillions of threads about MSVC non-compliance in a thousand of forums but I haven't seen any answer like - Hi I am from Microsoft, we are sorry we will fix it. The best you can hope for is "Hi, we know about the issue but it is not a priority. MAYBE we will address it in future releases" :(:(:(
Armen Tsirunyan
@Armen: Hmm valid point. Now I smell a new thread too. `:P`
Prasoon Saurav