On Wed, Feb 21, 2001 at 05:28:31PM +0100, Poul-Henning Kamp wrote:
> >Type-safety is a cruch for the weak-minded.
^
> As an old assembler programmer I couldn't agree more, but in a project
> like FreeBSD we have to realize that not everybody is that.
Heh, I was just cleani
In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
: Likewise if the first member were a more complex data type, but
: nevertheless the same between the different structures.
:
: It seems safe to me, but I can't explain why :-)
It is obfuscated 'C', but it is safe. The standard require
On Wed, Feb 21, 2001 at 08:53:57AM -0700, Warner Losh wrote:
> The standard requires that (void *) &foo == (void *) &foo->s
Thanks, that is what I was trying to track down but couldn't find it.
I also thought that perhaps a structure has the same requirement
alignments as its first member ... I
On Wed, Feb 21, 2001 at 05:13:35PM +0100, Poul-Henning Kamp wrote:
> In message <[EMAIL PROTECTED]>, Warner Losh writes:
> >In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
> >: Likewise if the first member were a more complex data type, but
> >: nevertheless the same between the differ
On Wed, Feb 21, 2001 at 09:56:08AM -0700, Warner Losh wrote:
> There is some verbage in the structure layout part of the standard
> that makes this a logical conclusion.
>
> However, it is overly tricky code. But then again to do the generic
> sort of thing you want to do, you have to resort to
:Is the following portable and safe?
:
:Given n different structure declarations, where each structure begins
:with the same member type, can any instance of any of the structures
:be cast to the (pointer) type of the first member?
:
:e.g.
:
: struct foo {
: const char *s;
: ...
:
In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
: On Wed, Feb 21, 2001 at 08:53:57AM -0700, Warner Losh wrote:
: > The standard requires that (void *) &foo == (void *) &foo->s
:
: Thanks, that is what I was trying to track down but couldn't find it.
: I also thought that perhaps a st
In message <[EMAIL PROTECTED]>, "Jacques A. Vidrine" writes:
>On Wed, Feb 21, 2001 at 05:13:35PM +0100, Poul-Henning Kamp wrote:
>> In message <[EMAIL PROTECTED]>, Warner Losh writes:
>> >In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
>> >: Likewise if the first member were a more com
In message <[EMAIL PROTECTED]>, Warner Losh writes:
>In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
>: Likewise if the first member were a more complex data type, but
>: nevertheless the same between the different structures.
>:
>: It seems safe to me, but I can't explain why :-)
>
>
In message <[EMAIL PROTECTED]> "Jacques A. Vidrine" writes:
: When you say ``resort to C macros,'' do you mean macros to hide the
: `type punning', or do you have something else in mind?
I had the queue macros in mind. Hiding the type punning behind a
macro helps make sure it is used right, but
10 matches
Mail list logo