Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #147521

Re: memcpy not memcpying?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: memcpy not memcpying?
Date Sat, 02 Nov 2019 18:22:32 -0700
Organization None to speak of
Lines 74
Message-ID <lnv9s169ev.fsf@kst-u.example.com> (permalink)
References <2LVuF.7$BF1.0@fx26.iad> <qSVuF.94$kE3.74@fx36.iad> <qphblr$leg$1@dont-email.me> <DHWuF.1569$kt1.1295@fx46.iad> <lnsgn77bw2.fsf@kst-u.example.com> <ji1vF.1277$FR8.1116@fx45.iad> <qpjrck$o01$1@dont-email.me> <6KfvF.57888$rJ1.57717@fx01.am4> <qpkakk$gq7$1@dont-email.me> <0DivF.23103$Q26.16540@fx34.am4> <ln7e4i6o0y.fsf@kst-u.example.com> <OcmvF.87562$Pt2.3193@fx23.am4> <ln36f57ul5.fsf@kst-u.example.com> <EAovF.246198$IsL.142854@fx08.am4>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info reader02.eternal-september.org; posting-host="885fb82be1e12b29daafc6f7a8ced528"; logging-data="3567"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ng+ClAR6fj01TyTQ4kHvc"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:gW+YJrUoxvgnYWWMQvPRO3nw9As= sha1:Ecr5SyHhP3Dl8kGHrnEL/Z0j5Rc=
Xref csiph.com comp.lang.c:147521

Show key headers only | View raw


Bart <bc@freeuk.com> writes:
> On 02/11/2019 22:59, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>
>> And yet you continue to whine about it.  Have fun with that.
>
> David Brown was trying to put the blame for the non-support of zu on 
> tcc, for which he has demonstrated a very poor opinion.

He was not.  He was pointing out, quite correctly, that supporting
"%zu" is not tcc's job any more than it's gcc's job.  The problem
is in the runtime library that's part of whatever implementation
you're using that includes tcc as its compiler component.

> I'm pointing out that my 500x bigger gcc installation has exactly same 
> problem.

Yes, I understood that the first time you said it.  Your 500x bigger
installation is using a C library that doesn't support "%zu".

>> Earlier today, I installed MinGW-w64.  "%zu" worked correctly.
>> If you don't care why, I certainly don't.
>
> That's nice. But I'm not prepared to trawl through my 26,000 files (for 
> tdm and mingw64) to try to figure what's going on. That's not my job.

Was I unclear?  Nobody is asking you to trawl through anything.
You've said you don't care, and I'm not even saying you should.

> I tell gcc - and its bundled headers, assembler, linkers and what-not - 
> that I want to call printf("%zu",sizeof(T)), it's its job to make it work.

Bart, you know what "gcc" is.  And again, you've already said you
don't care why "%zu" doesn't work for you.  Someone who really
didn't care would have stopped talking about it by now.

>> <stdint.h> defines a large number of integer types.  Defining printf and
>> scanf formats for *all* of them would, I think, have been an undue
>> burden.
>
> MS libraries support I64 and I32 width specifiers (as in "%I64d"). That 
> wouldn't have been a bad starting point.

Maybe -- but the MS libraries can assume that the implementation
supports integer types of exactly 32 and 64 bits.  The C standard
does not make that assumption.  For example, <inttypes.h>
defines macros PRId32, PRIdLEAST32, and PRIdFAST32 for int32_t,
int_least32_t, and int_fast32_t, respectively.  The type int32_t is
optional; int_least32_t and int_fast32_t are mandatory.  The standard
has to cover more possible target systems than Windows does (or
Linux, or POSIX), including systems that may not exist yet.

You can see a list of the macros in N1570 7.8.1.  Some of them
exist for each width, at least 8, 16, 32, and 64, for a total
of 84 PRI* macros and 70 SCN* macros if I've counted correctly.
(Exotic implementations might support other widths, or might
not support all of 8, 16, 32, and 64 for the exact-width types.)
You *could* implement those 154 possibilities directly in the *printf
and *scanf functions, with distinct syntaxes in the format strings,
but I prefer the way it's done in the standard.

I'm not saying that the PRI* and SCN* macros are ideal, but I
can't think of a cleaner way to define them while supporting the
same functionality.  No doubt your private language does it better,
but that doesn't help C.

(I've just noticed that there are macros for the [u]intmax_t types,
which are redundant with the 'j' length modifier.  I don't think that
redundancy is a problem.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 08:42 -0400
  Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 08:49 -0400
    Re: memcpy not memcpying? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-01 09:24 -0400
      Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 09:46 -0400
        Re: memcpy not memcpying? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-01 09:49 -0400
        Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-01 10:19 -0700
          Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-01 21:14 +0100
          Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 17:16 -0400
            Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-01 22:42 +0000
              Re: memcpy not memcpying? Richard Damon <Richard@Damon-Family.org> - 2019-11-01 21:10 -0400
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 11:36 +0000
            Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-02 02:15 -0700
            Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-02 13:04 +0100
              Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 13:43 +0000
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-02 17:24 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 17:00 +0000
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-02 13:06 -0700
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 21:05 +0000
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 22:40 +0000
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-02 15:59 -0700
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-02 23:47 +0000
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-02 18:22 -0700
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 13:27 +0000
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-03 17:46 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 17:20 +0000
                Re: memcpy not memcpying? Manfred <noname@add.invalid> - 2019-11-03 19:44 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 19:36 +0000
                Re: memcpy not memcpying? Manfred <noname@add.invalid> - 2019-11-03 22:57 +0100
                Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-03 22:39 +0000
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-03 23:06 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 23:28 +0000
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-04 11:00 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-04 11:14 +0000
                Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-04 11:22 +0000
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-04 13:10 +0100
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-04 10:03 -0800
                Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-04 19:36 +0000
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-05 10:04 -0800
                Re: memcpy not memcpying? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-04 20:58 -0800
                Re: memcpy not memcpying? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-11-04 22:01 -0800
                Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-04 12:56 +0100
                Re: memcpy not memcpying? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-04 09:50 -0500
                Re: memcpy not memcpying? scott@slp53.sl.home (Scott Lurndal) - 2019-11-04 20:26 +0000
                Re: memcpy not memcpying? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-04 04:34 -0800
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-04 13:05 +0000
                Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-04 14:09 +0000
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-04 15:11 +0000
                Re: memcpy not memcpying? Melzzzzz <Melzzzzz@zzzzz.com> - 2019-11-04 15:15 +0000
                Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-04 15:43 +0000
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 20:20 +0000
                Re: memcpy not memcpying? Ian Collins <ian-news@hotmail.com> - 2019-11-03 14:37 +1300
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 11:01 +0000
                Re: memcpy not memcpying? Öö Tiib <ootiib@hot.ee> - 2019-11-03 04:03 -0800
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 12:52 +0000
                Re: memcpy not memcpying? Öö Tiib <ootiib@hot.ee> - 2019-11-03 23:34 -0800
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-04 09:36 +0000
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-04 16:20 +0000
                Re: memcpy not memcpying? Ian Collins <ian-news@hotmail.com> - 2019-11-04 07:46 +1300
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-03 12:26 -0800
                Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-03 17:31 +0100
                Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-03 17:05 +0000
              Re: memcpy not memcpying? already5chosen@yahoo.com - 2019-11-03 09:14 -0800
                Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-03 12:32 -0800
                Re: memcpy not memcpying? already5chosen@yahoo.com - 2019-11-03 14:59 -0800
                Re: memcpy not memcpying? already5chosen@yahoo.com - 2019-11-03 15:19 -0800
                Re: memcpy not memcpying? already5chosen@yahoo.com - 2019-11-03 17:00 -0800
          Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-02 11:16 -0400
            Re: memcpy not memcpying? David Brown <david.brown@hesbynett.no> - 2019-11-02 17:26 +0100
    Re: memcpy not memcpying? Barry Schwarz <schwarzb@delq.com> - 2019-11-01 06:39 -0700
      Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 09:56 -0400
        Re: memcpy not memcpying? Barry Schwarz <schwarzb@delq.com> - 2019-11-01 12:39 -0700
    Re: memcpy not memcpying? guinness.tony@gmail.com - 2019-11-01 06:49 -0700
    Re: memcpy not memcpying? jak <nospam@please.ty> - 2019-11-01 20:40 +0100
  Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 14:26 +0100
    Re: memcpy not memcpying? Keith Thompson <kst-u@mib.org> - 2019-11-01 10:22 -0700
    Re: memcpy not memcpying? Bart <bc@freeuk.com> - 2019-11-01 19:44 +0000
      Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 21:31 +0100
  Re: memcpy not memcpying? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-01 09:39 -0400
    Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 14:42 +0100
      Re: memcpy not memcpying? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-01 09:48 -0400
  Re: memcpy not memcpying? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2019-11-01 06:47 -0700
    Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 14:58 +0100
      Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 10:22 -0400
        Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 18:38 +0100
          Re: memcpy not memcpying? scott@slp53.sl.home (Scott Lurndal) - 2019-11-01 17:54 +0000
            Re: memcpy not memcpying? Autist <autist69@gmail.com> - 2019-11-01 20:24 +0100
          Re: memcpy not memcpying? DFS <nospam@dfs.com> - 2019-11-01 15:24 -0400
        Re: memcpy not memcpying? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-11-01 23:19 +0000

csiph-web