Deutsch   English   Français   Italiano  
<20240609200014.000014be@yahoo.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Sun, 9 Jun 2024 20:00:14 +0300
Organization: A noiseless patient Spider
Lines: 95
Message-ID: <20240609200014.000014be@yahoo.com>
References: <v2l828$18v7f$1@dont-email.me>
	<v38of2$1gsj2$1@dont-email.me>
	<v39v87$1n7bk$1@dont-email.me>
	<20240530170836.00005fa0@yahoo.com>
	<v3a3k5$1ntrn$1@dont-email.me>
	<20240530180345.00003d9f@yahoo.com>
	<v3chc4$27uij$1@dont-email.me>
	<20240531161937.000063af@yahoo.com>
	<20240531162811.00006719@yahoo.com>
	<20240531164835.00007128@yahoo.com>
	<v3cldt$28n91$2@dont-email.me>
	<20240531173437.00003bee@yahoo.com>
	<v3d3ct$2b5sl$1@dont-email.me>
	<v3d97c$2c6ea$1@dont-email.me>
	<22r6O.5934$xPJ1.2590@fx09.iad>
	<v3t6nu$1liet$1@dont-email.me>
	<v3tlmo$1o860$7@dont-email.me>
	<v427sv$2no3h$1@dont-email.me>
	<v42cs4$2pjrh$1@dont-email.me>
	<20240609124032.00004eb1@yahoo.com>
	<v43vkr$3d7el$1@dont-email.me>
	<20240609141239.00006be6@yahoo.com>
	<v44lf7$3kpef$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 09 Jun 2024 19:00:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="6a2ea81ad9dc1fc6d46f58b03380a32f";
	logging-data="3694886"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19dydfiE6E0f2baccy/e0onLs2azvPrZ2g="
Cancel-Lock: sha1:CU7ax+PbFtvdaj23htpCMMCmwU0=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
Bytes: 4731

On Sun, 9 Jun 2024 17:32:40 +0100
bart <bc@freeuk.com> wrote:

> On 09/06/2024 12:12, Michael S wrote:
> > On Sun, 9 Jun 2024 11:20:11 +0100
> > bart <bc@freeuk.com> 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.

This page appear to give correct up to date instructions
https://www.msys2.org/#installation


> >> tcc gives 2KB, and mcc gives 2.5KB.
> >>  
> > 
> > x86-64 or i386?  
> 
> All were for x64.
> 
> gcc's stdio.h header defines `printf` (which my hello.c uses) as an 
> inlined wrapper based around  `__mingw_vasprintf()`. So there might
> be further inlined stuff or that is statically linked, before it
> finally ends up calling the real `printf`.
> 

The size you mentioned in the previous post is suspiciously similar to
the size VS2013 statically linked binary.

> With gcc, I get 39.9KB for -m32 -Os -s.
> 

That is smaller than statically linked 32-bit VS2013 (73,216 bytes).
But a lot bigger than 6,144 DLL-based VS2013 32bit binary.

> If I use 'puts' instead, and -m32, then it gets down to 14KB.
> 
>