Re: [releng_6 tinderbox] failure on sparc64/sparc64



Stefan Farfeleder <stefanf@xxxxxxxxxxx> writes:
On Sat, Feb 04, 2006 at 03:58:56PM -0700, M. Warner Losh wrote:
This driver wants to access these structures as arrays of uint32_t.
It used to cast directly, but that isn't allowed. So, I've passed
the cast through a (void *). Is that allowed? Eg:

struct foo foo;
((uint32_t *)(void *)&foo)[3] = 12;

is that OK?
I'm afraid that only silences the warning without solving the underlying
problem. I don't think there's a Standard conforming way to treat a
struct foo as an uint32_t array.

A union should do the trick.

DES
--
Dag-Erling Smørgrav - des@xxxxxx
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Function pointer to void function and int function
    ... struct foo f; ... ... If you call such a function through a `)' pointer, the compiler will not know it's supposed to generate the hidden `_value_ptr' argument nor the hidden `_returned_struct' object it should point to. ... that calls a function returning `int' and ignores the returned ... value is identical to the machinery that calls a `void' function. ...
    (comp.lang.c)
  • Re: alignment/zero length arrays
    ... The lists contain a void *, ... struct foo *f; ... This sets pointer f to point to the data in your element. ...
    (comp.lang.c)
  • Re: Opaque pointers
    ... pete wrote: ... extern T List_list (void *x, ... In your header file, you'd have something along the lines of: ... The actual definition of 'struct foo' goes in the source file: ...
    (comp.lang.c)
  • Re: Need template work-around in VC6
    ... struct Int2Type ... void Baz(const Int2Type&) ... doesn't understand explicit template arguments on a function invocation. ...
    (microsoft.public.dotnet.languages.vc)
  • alignment/zero length arrays
    ... The lists contain a void *, ... struct foo *f; ... int x,y,z; ...
    (comp.lang.c)