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
doubt in USING POINTERS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Gabriel Dos Reis, post: 1679352"] [...] | I still wonder about the semantics of this. I've just tried another | test program that assigns a value to *ptr and then prints it out. | This doesn't, of course, imply that doing so is valid; it could still | be undefined behavior. If it does something like print_value(set_value(func().arr, 4)); I would expect it to be valid -- I do not know any Standard text that implies so, though. In C++, which as the same notion of non-lvalue array, that would be valid. | The question is, what is the lifetime of the int object that ptr | points to? What I've found quite intriguing in the Standard is I'm under the impression that the notion of lifetime of temporaries has been completely hand waved. | It's part of the value returned by a function, so I | normally wouldn't expect it to outlive the expression containing the | call, but being able to grab a pointer to it makes it all very | confusing. Yup. In C++, the issue has been resolved by stating that the lifetime of a temporary lasts until the end of the full expression it is part of. -- Gaby [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
doubt in USING POINTERS
Top