Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
which is the better way to declare dynamic single dimension array inside struct
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Arthur J. O'Dwyer, post: 1703786"] UB on the fact that perhaps (sizeof(struct x)+strlen(data)) < (sizeof *y), for one thing. But I'll assume that you made a typo in the malloc line, and meant to write ^^^^^^^^ (Incidentally, I'll evangelize again: The canonical c.l.c idiom for malloc calls would avoid this bug.) Not really. C99 offers a *new syntax* for variable-sized arrays in the last part of a struct, but the old C90 "struct hack" is still not supported. (In fact, it's explicitly "un-supported," since it explicitly invokes undefined behavior.) Exactly. -Arthur [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
which is the better way to declare dynamic single dimension array inside struct
Top