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
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct));
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Irrwahn Grausewitz, post: 1706863"] intptr_t and uintptr_t are new features of C99, as is everything else in stdint.h. They're optional features, BTW. Have a look at [URL]http://gcc.gnu.org/c99status.html[/URL]. Ah, but you do, e.g. every time you use array subscription, 'walk' an array by incrementing a pointer, add the result of the offsetof macro to a pointer, subtract two pointers from each other, etc. Alas, there's no guarantee that you can cast back the result of your operations and get a valid pointer value, so it's effectively pretty useless. If you want to do pointer arithmetic, well, do arithmetic on pointers. Simple, isn't it? ;-) And you're right, because you're not supposed to know anything of the inner structure of pointers. After all, that's why pointer types are distinct from the other types. I wouldn't be surprised if somebody comes up with an example for an architecture where pointer values cannot meaningfully represented in an object of any integer type at all. Regards [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct));
Top