Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The mem functions are available as compiler built-ins, no need for libc.


No. While the compiler can optimize memcpy calls to direct loads/stores for small arguments (when inlining the loads/stores would be smaller than the cost of calling memcpy), for bigger or not statically know sizes it WILL call to memcpy in libc. And in fact it may even emit memcpy calls for things like struct copies.


whether you want the built-in to have the ability to refer to an external definition is a compiler flag.


Well, that depends on your compiler.


GCC is the standard.


Huh. Last time I looked at the standard, I didn't see where that was mentioned. Could you point me at the relevant section, please?


You don't appear to understand what the word standard means.


It's called GNU/C Standard

/jk


Not on Windows or Mac.


The platform compiler on Mac is Clang, which is specifically designed to be GCC-compatible, because GCC is the industry standard.


*rolls eyes*

1. There is no "industry standard" for C compilers, for instance in the game dev world, the closest thing to an "industry standard compiler" is MSVC, and not GCC or Clang.

2. While Clang tries to emulate some GCC-isms, it also has important differences to GCC. On Windows, Clang also emulates a lot of MSVC-isms, so emulating GCC really doesn't mean anything.*


Microsoft explicitly considers C legacy, and offer a C++ compiler instead.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: