Optimization I'd like to see compilers be able to make: if (strlen(s)>100) -> if (strnlen(s,101)>100)
The std functions are part of the language and gcc and clang already know about them.
-
-
The compiler and the stdlib are independently provided, and the stdlib is technically optional - specially important when dealing with embedded platforms - or an OS kernel.
-
Most is "optional" (not included in the spec) in a freestanding implementation. GCC and clang already honor -ffreestanding for this and omit special treatment of std functions then.
-
If you're compiling a kernel or libc without -ffreestanding that's a bug; they'll already make transformations that can break your code (like recursive self-calls).
-
-ffreestanding may suppress optimizations that introduce new stdlib calls, but isn’t it still UB for a function to be defined with the same name as a stdlib function and not have the same semantics? Dunno if gcc or clang exercise that even if so though
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.