December 07, 2002
#include <string.h>
#include <stdio.h>

#define STRINGIZE(a) DO_STRINGIZE(a)
#define DO_STRINGIZE(a) # a

#define LONG_LONG long long

int main()
{
  const char *s = STRINGIZE(LONG_LONG);

  printf("%d\n", strlen(s));
  printf("\"%s\"\n", s);

  return 0;
}


The result is:

12
"long longýú"

Not exactly what I had expected, here is the string as it appears in the
object file (from obj2asm):

D0      db      06ch,06fh,06eh,067h,020h,06ch,06fh,06eh
        db      067h,0fdh,0fah,001h,000h


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?
December 09, 2002
This test-case is still a bit complex (and doesn't do anything useful):

# define CAT(a, b) CAT_I(a, b)
# define CAT_I(a, b) a ## b
# define IIF(bit) IIF_I(bit)
# define IIF_I(bit) IIF_ ## bit()
# define AUTO_REC(pred) NODE_ENTRY_ ## 2(pred)
# define NODE_ENTRY_2(p) NODE_1(p)
# define NODE_1(p) IIF(p(1))
# define AB(x) AB_I(x)
# define AB_I(x) AB_ ## x
# define WHILE CAT(WHILE_, AUTO_REC(WHILE_P))
# define WHILE_P(n) AB(CAT(WHILE_CHECK_, WHILE_ ## n()))
# define WHILE_1() WHILE_1_C()
# define WHILE_1_C() 0

#define COUNT_DOWN_C(D,N) 0
#define COUNT_DOWN_F(D,N) 0

enum { x = WHILE(COUNT_DOWN_C,COUNT_DOWN_F,0) };



This is what I get from DM (using -e -l):

enum { x =          WHILE_IIF_AB_HILE_CHECK_ù0()
(COUNT_DOWN_C,COUNT_DOWN_F,0) };


At least "WHILE_IIF_AB_HILE_CHECK_ù0" can't be correct.


BTW, this is what I get from gcc 3.0:

enum { x = WHILE_IIF_AB_WHILE_CHECK_0()(COUNT_DOWN_C,COUNT_DOWN_F,0) };


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?