Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #4786
| From | "Balog Pal" <pasa@lib.hu> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: this cast to const char* |
| Date | 2011-05-06 20:15 +0200 |
| Organization | ETT newsserver |
| Message-ID | <iq1dsb$1k34$1@news.ett.com.ua> (permalink) |
| References | <92g50mFks4U1@mid.individual.net> <ipundf$2cb$1@hoshi.visyn.net> <ipvaqm$pfq$1@news.ett.com.ua> <4dc338b3$0$6974$9b4e6d93@newsspool4.arcor-online.net> |
"Marcel Müller" <news.5.maazl@spamgourmet.org>
[...]
> Furthermore, using this memory layout enables array classes in the same
> library to simply cast from CString* to const char** by a reinterpret
> cast, which would necessarily cause an allocation otherwise.
>
> So I would not bet that the implementation is done due to the printf
> compatibility. This is most likely a spin off.
Makes sense.
>> The visual compiler painfully lacks similar analiser as gcc's
>> __attribute__(format) that checks the types and format string
>> components, my usual tech s to use format helpers consistently. I.e:
>>
>> printf("int:%d, long: %ld, str: %s", f_d(i), f_ld(lo), f_s(str));
>
> Well, C++ and printf...
It was just example. With MFC you certainly use CString::Format. That is IME
superior to most alternatives in most cases I worked with. And the above
trick covers the practical problems. (Certainly I'd wish to have gcc-like
compiler support...)
> There is still no reasonable replacement in the standard. One must be
> stoned to use the iostream output operators, because besides being type
> safe they create completely unreadable code, at least if you use different
> formatting (like hex and decimal) concurrently.
Yeah. :(
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
this cast to const char* "Gernot Frisch" <me@privacy.net> - 2011-05-05 19:27 +0200
Re: this cast to const char* Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-05-05 19:39 +0200
Re: this cast to const char* "Balog Pal" <pasa@lib.hu> - 2011-05-06 01:11 +0200
Re: this cast to const char* Marcel Müller <news.5.maazl@spamgourmet.org> - 2011-05-06 01:54 +0200
Re: this cast to const char* m0shbear <andrey.vul@gmail.com> - 2011-05-05 17:59 -0700
Re: this cast to const char* James Kanze <james.kanze@gmail.com> - 2011-05-08 07:08 -0700
Re: this cast to const char* m0shbear <andrey.vul@gmail.com> - 2011-05-08 17:03 -0700
Re: this cast to const char* "Balog Pal" <pasa@lib.hu> - 2011-05-06 20:15 +0200
Re: this cast to const char* James Kanze <james.kanze@gmail.com> - 2011-05-08 07:05 -0700
Re: this cast to const char* James Kanze <james.kanze@gmail.com> - 2011-05-08 07:02 -0700
Re: this cast to const char* Felix Bytow <felix.bytow@informatik.tu-chemnitz.de> - 2011-05-05 19:40 +0200
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-05 10:52 -0700
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-05 10:44 -0700
Re: this cast to const char* gwowen <gwowen@gmail.com> - 2011-05-05 10:50 -0700
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-05 10:58 -0700
Re: this cast to const char* "Bo Persson" <bop@gmb.dk> - 2011-05-05 20:21 +0200
Re: this cast to const char* gwowen <gwowen@gmail.com> - 2011-05-05 11:27 -0700
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-05 11:37 -0700
Re: this cast to const char* gwowen <gwowen@gmail.com> - 2011-05-05 22:28 -0700
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-06 03:55 -0700
Re: this cast to const char* "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-05-06 13:25 +0200
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-06 06:22 -0700
Re: this cast to const char* Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-05 22:47 -0700
Re: this cast to const char* Goran <goran.pusic@gmail.com> - 2011-05-06 06:59 -0700
Re: this cast to const char* Pete Becker <pete@versatilecoding.com> - 2011-05-06 10:17 -0400
Re: this cast to const char* James Kanze <james.kanze@gmail.com> - 2011-05-08 07:13 -0700
Re: this cast to const char* "Gernot Frisch" <me@privacy.net> - 2011-05-09 10:38 +0200
Re: this cast to const char* Leigh Johnston <leigh@i42.co.uk> - 2011-05-09 13:03 +0100
Re: this cast to const char* Leigh Johnston <leigh@i42.co.uk> - 2011-05-09 17:51 +0100
Re: this cast to const char* Öö Tiib <ootiib@hot.ee> - 2011-05-09 09:40 -0700
csiph-web