hi,
I'm trying to port a small C-programm to C#
the only knowledge of C I got writing a programm that
created C/C++ code from pascal-code a long long time ago
Last summer that old machine which allowed me to run those
old borland programms died away so I can't debug some old
C-code anymore.
I've come about this line :
#define NUMBER(x) (sizeof(x) / sizeof(*x))
where NUMBER is used like this
NUMBER(fpgrouptab))
and fpgrouptab is
unsigned int fpgrouptab[] = { 0xd9e8, 0xd9f0, 0xd9f8 };
the first line I made
static object NUMBER( object x) { return(sizeof(x) / sizeof(*x)); }
the second
int[] fpgrouptab = new int[] { 0xd9e8, 0xd9f0, 0xd9f8 };
However I don't get the expression sizeof(x) / sizeof(*x)
I guess it's calculating some kind of count but I'm unable
to do this in C#
Can anyone help me with this problem
many thanks in advance
I'm trying to port a small C-programm to C#
the only knowledge of C I got writing a programm that
created C/C++ code from pascal-code a long long time ago
Last summer that old machine which allowed me to run those
old borland programms died away so I can't debug some old
C-code anymore.
I've come about this line :
#define NUMBER(x) (sizeof(x) / sizeof(*x))
where NUMBER is used like this
NUMBER(fpgrouptab))
and fpgrouptab is
unsigned int fpgrouptab[] = { 0xd9e8, 0xd9f0, 0xd9f8 };
the first line I made
static object NUMBER( object x) { return(sizeof(x) / sizeof(*x)); }
the second
int[] fpgrouptab = new int[] { 0xd9e8, 0xd9f0, 0xd9f8 };
However I don't get the expression sizeof(x) / sizeof(*x)
I guess it's calculating some kind of count but I'm unable
to do this in C#
Can anyone help me with this problem
many thanks in advance
Last edited: