Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #29651
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Making more of the C standard library mandatory for freestanding implementations |
| Date | 2020-05-09 16:10 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <r96dl9$lrp$1@dont-email.me> (permalink) |
| References | (8 earlier) <r948i4$9ps$1@solani.org> <r949r6$lrg$1@reader2.panix.com> <r94c4b$cj2$3@solani.org> <r94lj6$cea$1@dont-email.me> <riltG.275513$Xk.214486@fx46.iad> |
On 09/05/2020 00:45, Richard Damon wrote: > On 5/8/20 6:13 PM, David Brown wrote: >> On 08/05/2020 21:32, Philipp Klaus Krause wrote: >>> Am 08.05.20 um 20:53 schrieb Grant Edwards: >>>> On 2020-05-08, Philipp Klaus Krause <pkk@spth.de> wrote: >>>>> Am 08.05.20 um 17:56 schrieb Grant Edwards: >>>>>> >>>>>> What's the benefit of requiring extra stuff for a freestanding >>>>>> iplementation? >>>>> >>>>> Not requiring the users of freestanding implementations to roll their >>>>> own implementations of that extra stuff. >>>> >>>> That's what you expect when you decide to use a freestanding >>>> implmentation. If I want to use an the off-the shelf memcpy() >>>> function, why not just link with libc? >>> >>> Which libc? >>> A freestanding implementation's libc might not have memcpy(). A >>> third-party libc might not be available for my target device. >>> >> >> You are worrying about a non-existent problem. /All/ C toolchains come >> with memcpy() and similar functions - certainly anything that is >> realistic to include in a subset of the C library for freestanding >> toolchains. >> >> People /never/ have to write their own memcpy() - but in freestanding >> systems, they can if they want to. (Toolchains invariably come with >> memcpy, but that doesn't mean they come with a memcpy implementation >> that is ideal for your needs.) >> > > But you can't call your memcpy with the name memcpy because that name is > RESERVED with external linkage (even if the implementation doesn't > support it as a freestanding implementation). > > Yes, if the implementation doesn't support a function, you can probably > get away with defining one of your own by that name, but it isn't > guaranteed that it will work. > Again, there is a matter of practical realities. Trying to define your own memcpy() with that same name can be risky - it's the kind of function that implementations treat in special ways (such as the compiler replacing it with inline loops). It is definitely a bad idea to make your own definitions for a function like that with semantics that differ from the standard version. The standard linking process used by most implementations (but not required by the standards) means that if you have a definition of a function in your C code, that will take precedence over implementations in the library. It is not unusual in embedded programming to use this fact to have empty stubs for functions like "exit" or "atexit" as a way of avoiding too much extra code being pulled in from the standard library. This is all highly implementation-specific, of course.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-06 18:19 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-06 16:47 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-06 19:16 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-06 18:10 +0000
Re: Making more of the C standard library mandatory for freestanding implementations James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-05-06 15:10 -0400
Re: Making more of the C standard library mandatory for freestanding implementations Richard Damon <Richard@Damon-Family.org> - 2020-05-06 16:08 -0400
Re: Making more of the C standard library mandatory for freestanding implementations Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-05-06 13:22 -0700
Re: Making more of the C standard library mandatory for freestanding implementations Richard Damon <Richard@Damon-Family.org> - 2020-05-06 22:29 -0400
Re: Making more of the C standard library mandatory for freestanding implementations David Brown <david.brown@hesbynett.no> - 2020-05-07 15:43 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-06 22:36 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-06 20:57 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2020-05-06 23:25 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-06 21:34 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-07 10:17 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2020-05-07 18:45 +0300
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-07 10:16 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2020-05-07 21:39 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-07 21:44 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Paul Rubin <no.email@nospam.invalid> - 2020-05-07 12:54 -0700
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-06 22:34 +0200
Re: Making more of the C standard library mandatory for freestanding implementations upsidedown@downunder.com - 2020-05-07 09:13 +0300
Re: Making more of the C standard library mandatory for freestanding implementations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2020-05-07 18:47 +0300
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-07 15:51 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2020-05-08 10:09 +0300
Re: Making more of the C standard library mandatory for freestanding implementations Stefan Reuther <stefan.news@arcor.de> - 2020-05-07 18:00 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-07 17:17 +0000
Re: Making more of the C standard library mandatory for freestanding implementations David Brown <david.brown@hesbynett.no> - 2020-05-07 20:23 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Stefan Reuther <stefan.news@arcor.de> - 2020-05-08 17:33 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-08 15:56 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-08 20:31 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-08 18:53 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-08 21:32 +0200
Re: Making more of the C standard library mandatory for freestanding implementations David Brown <david.brown@hesbynett.no> - 2020-05-09 00:13 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Richard Damon <Richard@Damon-Family.org> - 2020-05-08 18:45 -0400
Re: Making more of the C standard library mandatory for freestanding implementations Grant Edwards <invalid@invalid.invalid> - 2020-05-08 22:59 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Richard Damon <Richard@Damon-Family.org> - 2020-05-09 08:29 -0400
Re: Making more of the C standard library mandatory for freestanding implementations David Brown <david.brown@hesbynett.no> - 2020-05-09 16:10 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2020-05-09 20:15 +0300
Re: Making more of the C standard library mandatory for freestanding implementations David Brown <david.brown@hesbynett.no> - 2020-05-10 12:37 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Stefan Reuther <stefan.news@arcor.de> - 2020-05-09 09:52 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Florian Weimer <fw@deneb.enyo.de> - 2020-05-08 18:48 +0200
Re: Making more of the C standard library mandatory for freestanding implementations Andrew Smallshaw <andrews@sdf.org> - 2020-05-08 17:01 +0000
Re: Making more of the C standard library mandatory for freestanding implementations Philipp Klaus Krause <pkk@spth.de> - 2020-05-08 20:05 +0200
csiph-web