Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Structs versus Vectors




On May 8, 2008, at 12:35PM, Wesley Smith wrote:

    typedef struct _NSPoint {
        float x;
        float y;
    } NSPoint;

You can always do:

NSPoint p;
glVertex2fv((float *)&p);

I found the following quote on the web which I think relates to this.

http://www.red-bean.com/guile/guile/new/msg02536.html

"ANSI C guarantees that it is safe to cast a pointer to a structure to a pointer to the type of that structure's first element."

However I can not find a statement like this in K&R C or the C99 standard. Perhaps I am not looking in the right place or it is worded differently in the standard. Does any one know where this is located in standard?

Best Regards,
Richard

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >Structs versus Vectors (From: Richard Somers <email@hidden>)
 >Re: Structs versus Vectors (From: "Wesley Smith" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.