473,378 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how best to get the offset of a field within a struct?

PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.

DISCUSSION:

Below is a sample program that demonstrates my solution. My questions
are:

(1) is this ANSI C compliant?
(2) is there a better way to solve this problem?
I think I'm on safe ground because casting and taking the address of
stuff does not cause memory to be accessed (i.e. pointers
dereferenced). In any event I seem to have satisfied GCC:
cd c:/cygwin/home/fj/offset/
make offset && ./offset
gcc -ansi -pedantic -o offset offset.c
MY_OFFSET(verybig_t, a) = 0x0
MY_OFFSET(verybig_t, g) = 0x20
MY_OFFSET(verybig_t, j) = 0x202a
MY_OFFSET(verybig_t, p) = 0x203a

Compilation finished at Fri Feb 17 11:41:58


Regards,
--jfc

================ begin sample program offset.c ================
#include <stdio.h>
typedef struct {
long a, b, c;
short e, f;
char name[13];
long g, h;
char stuff[1 << 13];
short i;
char j;
long k, l, m;
char n, o, p;
} verybig_t;

#define MY_OFFSET(type, field) ((unsigned long ) &(((type *)
0)->field))

int main(int argc, char * argv[])
{
printf("MY_OFFSET(verybig_t, a) = 0x%x\n", MY_OFFSET(verybig_t,
a));
printf("MY_OFFSET(verybig_t, g) = 0x%x\n", MY_OFFSET(verybig_t,
g));
printf("MY_OFFSET(verybig_t, j) = 0x%x\n", MY_OFFSET(verybig_t,
j));
printf("MY_OFFSET(verybig_t, p) = 0x%x\n", MY_OFFSET(verybig_t,
p));
return(0);
}

Feb 17 '06 #1
24 10269
funkyj a écrit :
#define MY_OFFSET(type, field) ((unsigned long ) &(((type *)
0)->field))


You should cast it to uintptr_t rather than unsigned long.
Feb 17 '06 #2


funkyj wrote On 02/17/06 14:44,:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.
Use the offsetof() macro, defined in <stddef.h>.
DISCUSSION:

Below is a sample program that demonstrates my solution. My questions
are:

(1) is this ANSI C compliant?
No.
(2) is there a better way to solve this problem?
Use the offsetof() macro, defined in <stddef.h>.
[snipped a variant of the non-portable pre-ANSI substitute
for the offsetof() macro, defined in <stddef.h>]


--
Er*********@sun.com

Feb 17 '06 #3
Thanks! Apparently I wasn't that far off. My local include files
implement it like this:

#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
/* ansi.h */
#define offsetof(type, member) __offsetof(type, member) /*
stddef.h */

Feb 17 '06 #4
On 2006-02-17 14:44:30 -0500, "funkyj" <fu****@gmail.com> said:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.

DISCUSSION:

Below is a sample program that demonstrates my solution. My questions
are:

(1) is this ANSI C compliant?
No, it is not. (Dereferencing a NULL pointer leads to undefined behavior)
(2) is there a better way to solve this problem?


Yes. You don't need to solve it, it has already been solved for you.
Just use the "offsetof" macro already provided for you by standard C.
--
Clark S. Cox, III
cl*******@gmail.com

Feb 17 '06 #5
Clark S. Cox III wrote:
On 2006-02-17 14:44:30 -0500, "funkyj" <fu****@gmail.com> said:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.
(1) is this ANSI C compliant?


No, it is not. (Dereferencing a NULL pointer leads to undefined behavior)


assuming one doesn't wish to use offsetof, what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}

Feb 17 '06 #6


tedu wrote On 02/17/06 16:24,:
Clark S. Cox III wrote:
On 2006-02-17 14:44:30 -0500, "funkyj" <fu****@gmail.com> said:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.
(1) is this ANSI C compliant?
No, it is not. (Dereferencing a NULL pointer leads to undefined behavior)

assuming one doesn't wish to use offsetof,


Why assume such a silly thing? "Assuming one doesn't
wish to use parentheses ..."
what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


How about "It doesn't work" -- does that qualify as a
"potential problem?" Sheesh ...

--
Er*********@sun.com

Feb 17 '06 #7
"tedu" <tu@zeitbombe.org> writes:
[...]
assuming one doesn't wish to use offsetof, what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


It can't be used in an expression.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 17 '06 #8
"funkyj" <fu****@gmail.com> writes:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.


Use the offsetof macro defined in <stddef.h>.

There is no portable way to implement offsetof in standard C. The
most common implementation dereferences a null pointer (invoking
undefined behavior) and depends on the compiler to recognize that it
doesn't actually have to generate code to perform that operation. The
standard does not guarantee that such an optimization will be
performed.

Code in the standard headers are allowed to do whatever non-portable,
implementation-defined, or just plain ugly things are necessary to
obtain the required results *with the particular compiler they're
written to work with*. That's why offsetof is in <stddef.h>. The
author of <stddef.h> is allowed to invoke undefined behavior as long
as it happens to yield the required result; you're not.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 17 '06 #9
Eric Sosman wrote:
tedu wrote On 02/17/06 16:24,:
assuming one doesn't wish to use offsetof,


Why assume such a silly thing? "Assuming one doesn't
wish to use parentheses ..."


to further one's understanding of C? is that permissible?
what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


How about "It doesn't work" -- does that qualify as a
"potential problem?" Sheesh ...


why not? i just noticed it's missing two casts. any other reason?
#define almostoffsetof(type, field, o) { \
type tmp_; \
o = (char *)tmp_.field - (char *)&tmp_; \
}
struct hanky { int a; int b; };
void f(void) {
struct hanky h;
int *x;
char *p;
ptrdiff_t o;
almostoffsetof(struct hanky, b, o);
p = (char *)&h;
p += o;
x = (int *)p; /* now x == &h.b */
}

why would x not be pointing to h.b?

Feb 17 '06 #10
funkyj wrote:
Thanks! Apparently I wasn't that far off. My local include files
implement it like this:

#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
/* ansi.h */
#define offsetof(type, member) __offsetof(type, member) /*
stddef.h */


Just because your system implements offsetof like that does not make it
portable. In fact, if you use that method, rather than just using the
offsetof macro provided by your system, it most definitely is *not*
portable.

offsetof is provided as a standard macros specifically because it is
*impossible* to implement it portably.
--
Flash Gordon
Living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidlines and intro -
http://clc-wiki.net/wiki/Intro_to_clc
Feb 17 '06 #11
tedu wrote:
Clark S. Cox III wrote:
On 2006-02-17 14:44:30 -0500, "funkyj" <fu****@gmail.com> said:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.
(1) is this ANSI C compliant?

No, it is not. (Dereferencing a NULL pointer leads to undefined behavior)


assuming one doesn't wish to use offsetof, what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


struct tmp_ {int a; int b;} tmp_
size_t o;

....

if (flag)
almostoffsetof(tmp_, b, o);
else
almostoffsetof(tmp_, a, o);

Should show you a couple of potential problems, one of which has a
standard solution the other is rather harder to avoid.
--
Flash Gordon
Living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidlines and intro -
http://clc-wiki.net/wiki/Intro_to_clc
Feb 17 '06 #12
On 2006-02-17, Keith Thompson <ks***@mib.org> wrote:
"funkyj" <fu****@gmail.com> writes:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.
Use the offsetof macro defined in <stddef.h>.

There is no portable way to implement offsetof in standard C. The
most common implementation dereferences a null pointer (invoking
undefined behavior) and depends on the compiler to recognize that it
doesn't actually have to generate code to perform that operation. The
standard does not guarantee that such an optimization will be
performed.


I thought that it was guaranteed that the side-effects of the argument
to sizeof will not be executed. i.e. sizeof printf("Hello, world!\n")
yields sizeof(int) and does not emit any output.

What's _not_ guaranteed is the ability to do pointer arithmetic on NULL.

You could always use a temporary, though, at the expense of not being
able to use it in an expression. Someone posting elsewhere in this
thread has done so.
Code in the standard headers are allowed to do whatever non-portable,
implementation-defined, or just plain ugly things are necessary to
obtain the required results *with the particular compiler they're
written to work with*. That's why offsetof is in <stddef.h>. The
author of <stddef.h> is allowed to invoke undefined behavior as long
as it happens to yield the required result; you're not.

Feb 17 '06 #13


tedu wrote On 02/17/06 17:45,:
Eric Sosman wrote:
tedu wrote On 02/17/06 16:24,:
assuming one doesn't wish to use offsetof,
Why assume such a silly thing? "Assuming one doesn't
wish to use parentheses ..."

to further one's understanding of C? is that permissible?


"Question authority." Furthering one's understanding
is not only permissible, but laudable. Occasionally, one
can even discover something new and useful by refusing to
use the established techniques. I read long ago that in
the fairly early days of electric lighting, new employees
at the light-bulb factory were instructed to frost the
insides of the clear bulbs so as to diffuse the light.
It couldn't be done, of course; this was a "hazing" of the
new employees, a "sleeveless errand." And one day, a new
kid who didn't know it was impossible figured out how to
do it ...

BUT there's a difference between constructive curiosity
and silliness that verges on the perverse. It's one thing
to try to come up with "something better" than offsetof, but
it's silly to propose something that's obviously worse. If
you had an idea for a niftier, slicker, and more convenient
alternative to offsetof, I'd encourage you to post it and
would be happy to review your effort. But when the thing
you've come up with is clunkier, stickier, and cruftier than
what already exists, that's another matter. In fact, it's
inferior to the already-dismissed-as-non-portable construct
the O.P. asked about. So why are you fiddling around?
what potential problems
exist with the following (aside from non compatible usage)?

#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


How about "It doesn't work" -- does that qualify as a
"potential problem?" Sheesh ...

why not? i just noticed it's missing two casts.


That's a "potential problem," I'd say.
any other reason?
#define almostoffsetof(type, field, o) { \
type tmp_; \
o = (char *)tmp_.field - (char *)&tmp_; \
}


What happens when

#define tmp_ getenv("TMPDIR")

appears earlier in the file?

--
Er*********@sun.com

Feb 17 '06 #14
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-17, Keith Thompson <ks***@mib.org> wrote: [...]
Use the offsetof macro defined in <stddef.h>.

There is no portable way to implement offsetof in standard C. The
most common implementation dereferences a null pointer (invoking
undefined behavior) and depends on the compiler to recognize that it
doesn't actually have to generate code to perform that operation. The
standard does not guarantee that such an optimization will be
performed.


I thought that it was guaranteed that the side-effects of the argument
to sizeof will not be executed. i.e. sizeof printf("Hello, world!\n")
yields sizeof(int) and does not emit any output.


Right (unless the argument is a VLA), but most implementations of
offsetof() don't use sizeof.
What's _not_ guaranteed is the ability to do pointer arithmetic on NULL.
Right.
You could always use a temporary, though, at the expense of not being
able to use it in an expression. Someone posting elsewhere in this
thread has done so.


Yes, but that's not an implementation of offsetof.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '06 #15
On 2006-02-17, Keith Thompson <ks***@mib.org> wrote:
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-17, Keith Thompson <ks***@mib.org> wrote:

[...]
Use the offsetof macro defined in <stddef.h>.

There is no portable way to implement offsetof in standard C. The
most common implementation dereferences a null pointer (invoking
undefined behavior) and depends on the compiler to recognize that it
doesn't actually have to generate code to perform that operation. The
standard does not guarantee that such an optimization will be
performed.


I thought that it was guaranteed that the side-effects of the argument
to sizeof will not be executed. i.e. sizeof printf("Hello, world!\n")
yields sizeof(int) and does not emit any output.


Right (unless the argument is a VLA), but most implementations of
offsetof() don't use sizeof.
What's _not_ guaranteed is the ability to do pointer arithmetic on NULL.


Right.


And that's more likely to be a serious problem than the "phantom
dereference". [taking the address of a member is essentially the same as
pointer arithmetic, and has the same problems if it fails]
You could always use a temporary, though, at the expense of not being
able to use it in an expression. Someone posting elsewhere in this
thread has done so.


Yes, but that's not an implementation of offsetof.


No, but it answers the original question well enough.
Feb 18 '06 #16
Eric Sosman wrote:
would be happy to review your effort. But when the thing
you've come up with is clunkier, stickier, and cruftier than
what already exists, that's another matter. In fact, it's
inferior to the already-dismissed-as-non-portable construct
the O.P. asked about. So why are you fiddling around?


just for the exercise.
#define almostoffsetof(type, field, o) { \
type tmp_; \
o = (char *)tmp_.field - (char *)&tmp_; \
}


What happens when

#define tmp_ getenv("TMPDIR")

appears earlier in the file?


you learn not to do that. :)

Feb 18 '06 #17
Eric Sosman wrote:
tedu wrote On 02/17/06 17:45,:
any other reason?
#define almostoffsetof(type, field, o) { \
type tmp_; \
o = (char *)tmp_.field - (char *)&tmp_; \
}


What happens when

#define tmp_ getenv("TMPDIR")

appears earlier in the file?


You wish C had namespaces ...

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Feb 18 '06 #18
Keith Thompson wrote:
"funkyj" <fu****@gmail.com> writes:
PROBLEM STATEMENT:
I want to calculate the byte offset of a field with a struct at
compile time without instantiating an instance of the struct at
runtime AND I want to do this in an ANSI standard compliant
fashion.


There is no portable way to implement offsetof in standard C.


I suposse the following two methods are not standard due to the pointer
conversions. But I do not in how many points they break the rules:

(Another subject, less important in some context, is the limit of
offset value)
(Sorry for the amount of parenthesis)

#include <stdio.h>
#include <stdlib.h>

typedef struct
{
int f1;
char f2;
} s1;

static void *foo;
#define offsetof1(x,a) ( (char *)&( ((x *)foo)->a ) - (char *)foo )
#define offsetof2(x,a) ( *(char *) ( &(((x *)foo)->a) ) )

int main ( void )
{
/* init */
int i;
foo=malloc(256);
for(i=0;i<256;i++) ((char *)foo)[i]=i;

/* method 1 */
printf("%d\n",offsetof1(s1,f2));

/* method 2 */
printf("%d\n",offsetof2(s1,f2));
}

Kind regards.

Feb 18 '06 #19
"tmp123" <tm****@menta.net> writes:
Keith Thompson wrote:
"funkyj" <fu****@gmail.com> writes:
> PROBLEM STATEMENT:
> I want to calculate the byte offset of a field with a struct at
> compile time without instantiating an instance of the struct at
> runtime AND I want to do this in an ANSI standard compliant
> fashion.


There is no portable way to implement offsetof in standard C.


I suposse the following two methods are not standard due to the pointer
conversions. But I do not in how many points they break the rules:

(Another subject, less important in some context, is the limit of
offset value)
(Sorry for the amount of parenthesis)

#include <stdio.h>
#include <stdlib.h>

typedef struct
{
int f1;
char f2;
} s1;

static void *foo;
#define offsetof1(x,a) ( (char *)&( ((x *)foo)->a ) - (char *)foo )
#define offsetof2(x,a) ( *(char *) ( &(((x *)foo)->a) ) )


foo is a static pointer object; it's therefore initialized to NULL.
(Since it's not const, you could mess it up by assigning a value to
foo.)

Both are similar to the common definition of offset(), except that
they use foo rather than a literal 0. Both dereference a null pointer
and count on the compiler to optimize well enough so that the
dereference isn't actually executed. offsetof2 seems to assumes that
a null pointer is all-bits-zero (though it's hard to say, since that
assumption isn't sufficient to make it work).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '06 #20

Keith Thompson wrote:
"tmp123" <tm****@menta.net> writes:
Keith Thompson wrote:
"funkyj" <fu****@gmail.com> writes:
> PROBLEM STATEMENT:
> I want to calculate the byte offset of a field with a struct at
> compile time without instantiating an instance of the struct at
> runtime AND I want to do this in an ANSI standard compliant
> fashion.

There is no portable way to implement offsetof in standard C.


I suposse the following two methods are not standard due to the pointer
conversions. But I do not in how many points they break the rules:
...
static void *foo;
#define offsetof1(x,a) ( (char *)&( ((x *)foo)->a ) - (char *)foo )
#define offsetof2(x,a) ( *(char *) ( &(((x *)foo)->a) ) )


foo is a static pointer object; it's therefore initialized to NULL.
(Since it's not const, you could mess it up by assigning a value to
foo.)

Both are similar to the common definition of offset(), except that
they use foo rather than a literal 0. Both dereference a null pointer


Sorry, I've not been clear enough. Please, see at init part of the main
function (I repeat it because it has been snipped):

/* init */
int i;
foo=malloc(256);
for(i=0;i<256;i++) ((char *)foo)[i]=i;

Moreover, method 2 doesn't uses pointer substraction.

Kind regards.

Feb 18 '06 #21
"tmp123" <tm****@menta.net> writes:
Keith Thompson wrote:
"tmp123" <tm****@menta.net> writes:
> Keith Thompson wrote:
>> "funkyj" <fu****@gmail.com> writes:
>> > PROBLEM STATEMENT:
>> > I want to calculate the byte offset of a field with a struct at
>> > compile time without instantiating an instance of the struct at
>> > runtime AND I want to do this in an ANSI standard compliant
>> > fashion.
>>
>> There is no portable way to implement offsetof in standard C.
>
> I suposse the following two methods are not standard due to the pointer
> conversions. But I do not in how many points they break the rules:
>...
> static void *foo;
> #define offsetof1(x,a) ( (char *)&( ((x *)foo)->a ) - (char *)foo )
> #define offsetof2(x,a) ( *(char *) ( &(((x *)foo)->a) ) )


foo is a static pointer object; it's therefore initialized to NULL.
(Since it's not const, you could mess it up by assigning a value to
foo.)

Both are similar to the common definition of offset(), except that
they use foo rather than a literal 0. Both dereference a null pointer


Sorry, I've not been clear enough. Please, see at init part of the main
function (I repeat it because it has been snipped):

/* init */
int i;
foo=malloc(256);
for(i=0;i<256;i++) ((char *)foo)[i]=i;

Moreover, method 2 doesn't uses pointer substraction.


Sorry, I didn't read carefully enough.

Both offsetof1 and offsetof2 depend on the existence of an object
"foo" (used to provide a valid address, where the usual implementation
uses a null pointer). offsetof1 invokes undefined behavior if the
offset is greater than 255 bytes; offset2 depends on the stored value,
and won't work at all for offsets greater than 255. For offsetof1 to
work in the general case, you'd need foo to be as large as the largest
possible struct; offsetof2 works only with 1-byte array elements (and
even then you'd want unsigned char rather than char).

I think offsetof1 is probably about as close as you can get to a
portable implementation, but every compiler supports a non-portable
implementation that doesn't have the same drawbacks.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 18 '06 #22
The suspicion that I was doing something fishy was what let me to post
my question. Your summary above touches on the key points.

The C standard authors put offsetof() in the standard library so that
the language need not provide a portable way of doing this by hand.
This language design choice provides the user with the needed
functionality (i.e. offsetof()) while giving the compiler writer more
latitude.

Thanks!
--jfc

Feb 21 '06 #23
"funkyj" <fu****@gmail.com> writes:
The suspicion that I was doing something fishy was what let me to post
my question. Your summary above touches on the key points.
What summary? There's nothing "above", and the article to which you
replied isn't available on my news server.

Please please *please* read <http://cfaj.freeshell.org/google/>.
The C standard authors put offsetof() in the standard library so that
the language need not provide a portable way of doing this by hand.
This language design choice provides the user with the needed
functionality (i.e. offsetof()) while giving the compiler writer more
latitude.


Correct.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 21 '06 #24
On Fri, 17 Feb 2006 22:22:13 +0000, Flash Gordon
<sp**@flash-gordon.me.uk> wrote:
tedu wrote:
#define almostoffsetof(type, field, o) { \
type tmp_; \
o = &tmp_.field - &tmp_; \
}


later corrected to (char*)&tmp_.field - (char*)&tmp_

struct tmp_ {int a; int b;} tmp_
size_t o; if (flag)
almostoffsetof(tmp_, b, o);
else
almostoffsetof(tmp_, a, o);

Should show you a couple of potential problems, one of which has a
standard solution the other is rather harder to avoid.


That won't compile; first you're missing a semicolon, then (in C) tmp_
is not a typename as required by both his almostoffsetof() and
standard offsetof(). You could either use struct tmp_ for the
typename, or change the struct declaration to a typedef, and either
way I see no problem.

- David.Thompson1 at worldnet.att.net
Feb 27 '06 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Bradford Chamberlain | last post by:
I work a lot with multidimensional arrays of dynamic size in C, implementing them using a single-dimensional C array and the appropriate multipliers and offsets to index into it appropriately. I...
1
by: mrhicks | last post by:
Hello all, I am trying to keep my coding easy for everyone to use. I have some ARINC data that need to go out which 12 Bytes long. The first byte is the command word, the next 10 bytes represent...
0
by: lawrence | last post by:
How to deal with pointer field in struct in idl So that C# can call C++ COM? e.g. in C++ COM Server IDL: typedef struct { long *xPos; long yPos; } MYPOINT;
1
by: J | last post by:
I'm interfacing with a C api (via Interop) which uses the following typedef struct... typedef struct _columnflags { BYTE bNoUpdate : 1; BYTE bSetToNull : 1; BYTE bDefault : 1; }...
1
by: rouble | last post by:
Hi All, How do I verify if a field within an ADODB.Recordset is NULL ? I have tried the following two methods that I could think of: 1. If Not IsNothing(rs("fieldname")) Then something =...
2
by: ice88 | last post by:
i have problem in define struct within struct struct student_detail { int id; string name; }; struct subject_detail
2
by: zufie | last post by:
How would I transfer the values from my WorkPhone field to my CellPhone field within the same table IBCCP Referral? Thanks!, John
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.