Sujet : Re: C23 thoughts and opinions
De : bohannonindustriesllc (at) *nospam* gmail.com (BGB-Alt)
Groupes : comp.lang.cDate : 07. Jun 2024, 22:58:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3vvph$27spv$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Mozilla Thunderbird
On 6/6/2024 7:53 PM, Lawrence D'Oliveiro wrote:
On Thu, 6 Jun 2024 15:38:21 -0500, BGB-Alt wrote:
*2: Seemingly the main way I am aware of to get small binaries is to use
an older version of MSVC (such as 6.0 to 9.0), as the binary-bloat
started to get much more obvious around Visual Studio 2010, but is less
of an issue with VS2005 or VS2008.
Newer version of proprietary compiler generates worse code than older
version?!?
Or, at least, bulkier code...
It terms of other factors, it is pros/cons:
Supports C features newer than C89/C95;
Is clever enough to generate sensible inline code for "memcpy()"
...
These older versions tended either to always emit a function call, or on the latter end, turn it into "REP MOVSB" or similar, etc.
I think code generation went in the bulky direction when they started adding auto-vectorization, and not really any option to be like "Yes, I want SIMD instructions enabled, but, no, don't autovectorize."
Sometimes vectorization makes things faster, sometimes not, but one thing it does do, is make the generated binaries bigger.
Comparably, GCC seems to be a little more behaved in this areas, at least as far as it doesn't add bulk (but, does have the annoyance of defaulting to strict aliasing semantics, and also sometimes generating code that will break if one uses misaligned pointers, etc).
Newer versions of MSVC tend to be more clever about things like "memcpy()", albeit not to the same level as GCC (which can entirely optimize it away, rather than turning it into memory loads and stores).
Also, "-Os" in GCC is pretty good about disabling any optimizations which would add bulk, ...
So, it is pros/cons.
...