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
Qry : Behaviour of fgets -- ?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="=?iso-2022-kr?q?Harald_van_D=0E=29=26=0Fk?=, post: 3052922"] By only using the execution path that calls strlen when the argument is a constant. The as-if rule allows the argument to be evaluated multiple times, so long as a correct program cannot tell the difference. Reformatted a bit for readabiliy, it looks like this: #define strcpy(dest, src) \ (__extension__ (__builtin_constant_p (src) \ ? (__string2_1bptr_p (src) \ && strlen (src) + 1 <= 8 \ ? __strcpy_small (dest, \ __strcpy_args (src), \ strlen (src) + 1) \ : (char *) memcpy (dest, src, \ strlen (src) + 1)) \ : strcpy (dest, src))) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Qry : Behaviour of fgets -- ?
Top