On Mon, May 7, 2012 at 8:06 AM, Charles Srstka <cocoa...@charlessoft.com> wrote:
> Myself, I like to just spin off a method or function that takes a chunk of 
> data and populates the fields of the struct one by one, instead of writing 
> the data straight onto the struct. A little more code, but you know it’s 
> going to work right without any surprises.

Not only that, but writing structs to file handles has caused security
problems before. Consider what happens if you have a short or byte
field and the compiler pads the struct. Now there's memory in your
struct that never gets initialized. If you write that to a file or
socket you're sending whatever might have been lurking there.
Passwords, login details...

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to