www.digitalmars.com         C & C++   DMDScript  

c++.beta - DMC 8.39.1 bug: sizeof(char_constant)

reply mfx <markus oberhumer.com> writes:
BTW, I do have two more bug reports (internal error "go 235" and
"cgcod 1741"), but for this I'd need a "preprocess only" functionality -
I've tried "dmc -e" without success. Any hints ?

Cheers,
Markus

/* Digital Mars 8.39.1 (2003-12-07) bug report
  *
  *   sizeof('x') [char constant] is wrong under C
  *
  * How to repeat:
  *   dmc bug02.c
  *   bug02.exe
  *
  * Markus F.X.J. Oberhumer <markus oberhumer.com>
  *
  * vi:ts=4:et
  */

#include <stdio.h>
#include <assert.h>

int main()
{
#if defined(__cplusplus)
     /* DMC is correct */
     assert(sizeof('x') == 1);
#else
     /* DMC bug - char constant must promote to int */
     assert(sizeof('x') == sizeof(int));
#endif
     return 0;
}
Dec 10 2003
parent "Walter" <walter digitalmars.com> writes:
"mfx" <markus oberhumer.com> wrote in message
news:br6mdp$2mvq$1 digitaldaemon.com...
 BTW, I do have two more bug reports (internal error "go 235" and
 "cgcod 1741"), but for this I'd need a "preprocess only" functionality -
 I've tried "dmc -e" without success. Any hints ?
Try spp.exe (the preprocessor). Or dmc -e -l (creates a .lst file).
Dec 10 2003