Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Memorry error? |
| Date | 2015-11-19 10:41 +0000 |
| Organization | Go wash your mouth. |
| Message-ID | <564da697.4555734@news.xs4all.nl> (permalink) |
| References | (3 earlier) <08a9550d-31e5-4180-a9cf-2d19aa22c42b@googlegroups.com> <0gn04bpg79ogvjinagveb5es1qi22i2mod@4ax.com> <lnd1vjyw7u.fsf@kst-u.example.com> <564ba747.26087359@news.xs4all.nl> <lnsi44i4p4.fsf@kst-u.example.com> |
Keith Thompson <kst-u@mib.org> wrote: > raltbos@xs4all.nl (Richard Bos) writes: > > Keith Thompson <kst-u@mib.org> wrote: > [...] > >> I suspect that the same header that declared GetString has: > >> > >> typedef char *string; > >> > >> If so, that's unfortunate, since it encourages the misconception that > >> strings are "really" pointers. (A string is by definition "a contiguous > >> sequence of characters terminated by and including the first null > >> character"; a char* may or may not be a pointer to a string.) > > > > It's equally unfortunate because it pretends that strings are _not_ > > "really" pointers, but some weird abstract type that might somehow > > change from a character sequence accessed by a char *. > > I don't follow you. You seem to be implying that strings are "really > pointers", which they most certainly are not. No, the string itself is not a pointer. But the object you use to access that string really _is_ a pointer. My point was that hiding char * behind a "string" typedef hides _both_ of these facts, that a string is a set of characters which isn't a pointer, and also that a string is accessed through a bog-standard char *. For a thorough understanding of how C treats strings and char pointers (and pointers in general, really), it is important to realise that this works just fine without needing to hide it behind a typedef. So the typedef is even more unfortunate than you already pointed out. Richard
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 05:18 -0800
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 05:19 -0800
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 05:27 -0800
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 05:30 -0800
Re: Memorry error? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-07 08:36 -0500
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 06:43 -0800
Re: Memorry error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-07 17:22 +0000
Re: Memorry error? "Osmium" <r124c4u102@comcast.net> - 2015-11-07 07:33 -0600
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-07 06:47 -0800
Re: Memorry error? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-07 10:36 -0500
Re: Memorry error? Keith Thompson <kst-u@mib.org> - 2015-11-07 13:37 -0800
Re: Memorry error? Barry Schwarz <schwarzb@dqel.com> - 2015-11-07 16:26 -0800
Re: Memorry error? Alla _ <modelling.data@gmail.com> - 2015-11-08 23:03 -0800
Re: Memorry error? Barry Schwarz <schwarzb@dqel.com> - 2015-11-09 01:01 -0800
Re: Memorry error? Keith Thompson <kst-u@mib.org> - 2015-11-09 08:27 -0800
Re: Memorry error? raltbos@xs4all.nl (Richard Bos) - 2015-11-17 22:23 +0000
Re: Memorry error? Keith Thompson <kst-u@mib.org> - 2015-11-17 15:31 -0800
Re: Memorry error? raltbos@xs4all.nl (Richard Bos) - 2015-11-19 10:41 +0000
Re: Memorry error? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-11-09 10:26 +0000
csiph-web