Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: memset extensions |
| Date | 2015-11-11 09:09 -0800 |
| Organization | None to speak of |
| Message-ID | <ln8u64sbt7.fsf@kst-u.example.com> (permalink) |
| References | <n1v3pk$967$1@dont-email.me> |
jacobnavia <jacob@jacob.remcomp.fr> writes:
> void *memset(void *srcPtr,unsigned char value,size_t size);
The actual declaration of memset is:
void *memset(void *s, int c, size_t n);
The second argument is converted to unsigned char. (It would make
more sense for the argument to be of type unsigned char, but memset()
probably predates both the unsigned char and prototypes.)
> I want to add extensions to it:
>
> void memset16( void *srcPtr, int16_t value, size_t size);
> void memset32( void *srcPtr, int32_t value, size_t size);
> void memset64( void *srcPtr, int64_t value, size_t size);
> void memset128(void *srcPtr, int128_t value, size_t size);
Others have commented on the names. I suggest that the second
parameter should be of an unsigned type.
If you're suggesting that these be added to the standard, none of the
[u]intN_t types are required. Because of that, it would probably be
more consistent to use unsigned short, unsigned int, unsigned long,
unsigned long long. (And int128_t is very likely not to exist.)
If this is only for your own implementation, then the uintN_t types
are probably ok.
The behavior should be undefined if the target isn't properly
aligned.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 11:05 +0100
Re: memset extensions Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-11-11 11:08 +0100
Re: memset extensions "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-11 04:56 -0800
Re: memset extensions Philipp Klaus Krause <pkk@spth.de> - 2015-11-11 13:39 +0100
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 17:34 +0100
Re: memset extensions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-11 17:22 +0000
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 21:19 +0100
Re: memset extensions Keith Thompson <kst-u@mib.org> - 2015-11-11 12:51 -0800
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 16:01 -0500
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 22:03 +0100
Re: memset extensions Keith Thompson <kst-u@mib.org> - 2015-11-11 13:19 -0800
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 22:45 +0100
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 16:51 -0500
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 23:01 +0100
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 17:29 -0500
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 23:36 +0100
Re: memset extensions Keith Thompson <kst-u@mib.org> - 2015-11-11 15:00 -0800
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 16:48 -0500
Re: memset extensions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-11 22:15 +0000
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 08:05 -0500
Re: memset extensions Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-11 08:31 -0500
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 17:34 +0100
Re: memset extensions Les Cargill <lcargill99@comcast.com> - 2015-11-11 08:30 -0600
Re: memset extensions Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-11 09:48 -0500
Re: memset extensions gwowen <gwowen@gmail.com> - 2015-11-11 07:55 -0800
Re: memset extensions James Kuyper <jameskuyper@verizon.net> - 2015-11-11 11:24 -0500
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 17:32 +0100
Re: memset extensions Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-11 11:44 -0500
Re: memset extensions raltbos@xs4all.nl (Richard Bos) - 2015-11-17 22:53 +0000
Re: memset extensions supercat@casperkitty.com - 2015-11-17 15:37 -0800
Re: memset extensions raltbos@xs4all.nl (Richard Bos) - 2015-11-20 11:27 +0000
Re: memset extensions supercat@casperkitty.com - 2015-11-20 08:45 -0800
Re: memset extensions supercat@casperkitty.com - 2015-11-11 08:25 -0800
Re: memset extensions Keith Thompson <kst-u@mib.org> - 2015-11-11 09:09 -0800
Re: memset extensions supercat@casperkitty.com - 2015-11-11 09:18 -0800
Re: memset extensions Keith Thompson <kst-u@mib.org> - 2015-11-11 10:57 -0800
Re: memset extensions jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-11 21:17 +0100
csiph-web