Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: bart Newsgroups: comp.lang.c Subject: Re: C23 thoughts and opinions Date: Sun, 9 Jun 2024 21:06:00 +0100 Organization: A noiseless patient Spider Lines: 139 Message-ID: References: <20240530170836.00005fa0@yahoo.com> <20240530180345.00003d9f@yahoo.com> <20240531161937.000063af@yahoo.com> <20240531162811.00006719@yahoo.com> <20240531164835.00007128@yahoo.com> <20240531173437.00003bee@yahoo.com> <22r6O.5934$xPJ1.2590@fx09.iad> <20240609124032.00004eb1@yahoo.com> <20240609141239.00006be6@yahoo.com> <20240609200014.000014be@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 09 Jun 2024 22:06:00 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c28d470d38d584b11aaddf66f652d961"; logging-data="3958893"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YuhN5yk4eNwWdFESOLaF2" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:bPBpFHH0WKHahWKfqgmXYDvkTwM= In-Reply-To: <20240609200014.000014be@yahoo.com> Content-Language: en-GB Bytes: 6976 On 09/06/2024 18:00, Michael S wrote: > On Sun, 9 Jun 2024 17:32:40 +0100 > bart wrote: > >> On 09/06/2024 12:12, Michael S wrote: >>> On Sun, 9 Jun 2024 11:20:11 +0100 >>> bart wrote: >>> >> >>>>> GCC on Windows or on Linux? >>>>> In my experience, gcc on Windows (ucrt64 variant, other gcc >>>>> variants are worse) very consistently produces bigger (stripped) >>>>> exe than even latest MSVCs which, as you correctly stated, are >>>>> not as good as older versions at producing small code. >>>>> >>>>> The size of 'Hello, world' program (x86-64, dynamically linked C >>>>> RTL) vs2013 - 6,144 bytes >>>>> vs2019 - 9,216 bytes >>>>> gcc (Debian Linux, -no-pie) - 14,400 bytes >>>>> gcc (Debian Linux) - 14,472 bytes >>>>> gcc (ucrt64 DLL) - 18,432 bytes >>>>> gcc (old DLL) - 42,496 bytes >>>> >>>> I get a lot worse than that: >>>> >>>> C:\c>gcc hello.c >>>> >>>> C:\c>dir a.exe >>>> 09/06/2024 11:04 367,349 a.exe >>>> >>>> C:\c>gcc hello.c -s -Os >>>> >>>> C:\c>dir a.exe >>>> 09/06/2024 11:04 88,064 a.exe >>>> >>>> (It didn't like -Oz; did you mean something other than -Os?) >>>> >>> >>> No, I meant -Oz. >>> It was invented by clang, but newer gcc understand it. >>> I don't know what is a difference exactly, but -Oz tends to be a >>> little smaller. >>> In program as trivial as this, there should be no difference. >>> >>>> Both import msvcrt.dll. gcc is version 10.3.0. >>>> >>> >>> My gcc variants are from msys2. >>> Where did you get yours? >> >> It's gcc/TDM. > > I never heard about TDM except from you. > >> Anything else, I can spend 10 minutes following links >> to a mingw download, only to end up back where I started from. >> gcc/TDM is a much simpler installation. >> > > Somehow, I installed msys2 many times, using 2 or 3 different methods > and it worked every single time. It's huge download, but it works. > There were cases where I had problems installing additional packages on > top of msys2, but they were always caused by idiotic policies of > corporate IT. At my personal systems it was always flawless. I'm not talking about MSYS2. I'm not even sure what it is. msys2.org describes it as: "MSYS2 is software distribution and a building platform for Windows. It provides a Unix-like environment, a command-line interface and a software repository making it easier to install, use, build and port software on Windows. That means Bash, Autotools, Make, Git, GCC, GDB..., all easily installable through Pacman, a fully-featured package manager." Um, I only want an optimising C compiler, nothing else! And especially I do NOT want a 'Unix-like' environment; I think it is entirely unnecessary for a tool that simply converts .c files into .exe files. > This page appear to give correct up to date instructions > https://www.msys2.org/#installation Today I tried once more to install mingw gcc. One hit gave me this page: https://www.naukri.com/code360/library/gcc-compiler-for-windows Step 1 tells me to click here: https://sourceforge.net/projects/mingw-w64/ It says: "A complete runtime environment for gcc"; hmm; it doesn't sound like a compiler! But I'm just following the instructions. After 10 minutes I had a 110B installation with 6000 files, but none was the 85KB EXE file mentioned in step 3, which isn't even part of the ZIP according to the screen shot. Where does that file come from? So I tried a different tack; that took me here: https://sourceforge.net/projects/mingw/ This one turns out to be that 85KB file that was missing before! OK, let's do it. It shows a list of things to install, including MSYS2 (no thanks) and compilers for Ada, C++, Fortran, Objective-C, but no C, unless it is the 'base' package? I have really no idea. I click that, but then what? There is no Install, Proceed, Get, or OK button! But under a pulldown menu, there is Apply Changes. Now it's doing something. At the end there was no specific message, but it said somewhere: This package has not been installed;... But I tried it anyway (notice this is from a normal command line): C:\c>gcc --version gcc (MinGW.org GCC-6.3.0-1) 6.3.0 So it's version 6 of gcc! Nowhere do I remember seeing that mentioned. I don't normally waste my time going down these futile rabbitholes, but sometimes it can be fun as you get to see some appallingly bad installation processes. Of course, people will go to any lengths to defend these very complex products, and will explain to you why it is good idea to separate out compiler, headers, assembler, linker, library into lots of different pieces, all with names that are subtle variations of mingw and w64 This is why I prefer TDM: https://jmeubank.github.io/tdm-gcc/ Click on the version you want. Other Windows C compilers are even simpler, and smaller. (TDM is 0.5GB, Tiny C is under 0.002GB, and own 'bcc' is 0.001GB. My own non-C compiler is 0.0004GB. Both my products are single EXE files.)