public inbox for cygwin-talk@cygwin.com
 help / color / mirror / Atom feed
* Why I love C++ so much.
@ 2008-02-20 20:15 Dave Korn
  2008-02-20 20:52 ` Brian Dessent
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Dave Korn @ 2008-02-20 20:15 UTC (permalink / raw)
  To: 'to a child with c++,
	every problem looks like you need a pseudo-operator'




  Because writing

  hex << setw (8) << setfill ('0') << ((uintptr_t)(x)) << dec << setfill (' ')

is just soooooo much easier and more self-consistent and less typing than

  "%08x", x



<grrrspit>

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-20 20:15 Why I love C++ so much Dave Korn
@ 2008-02-20 20:52 ` Brian Dessent
  2008-02-20 21:45   ` Dave Korn
  2008-02-21  1:20 ` Gary R. Van Sickle
  2008-02-21  6:32 ` Václav Haisman
  2 siblings, 1 reply; 20+ messages in thread
From: Brian Dessent @ 2008-02-20 20:52 UTC (permalink / raw)
  To: The Vulgar and Unprofessional Cygwin-Talk List

Dave Korn wrote:

> is just soooooo much easier and more self-consistent and less typing than
> 
>   "%08x", x

Oh, don't be so hard on C++.  I mean, sure, some things are a little
clunky, but it makes up for it with such interesting compile errors:

example.cc:21: conversion from `double' to non-scalar type
`map<vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > >,set<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,less<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > >,less<vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > >,allocator<set<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,less<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > >,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> > > > > >' requested

Brian

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-20 20:52 ` Brian Dessent
@ 2008-02-20 21:45   ` Dave Korn
  0 siblings, 0 replies; 20+ messages in thread
From: Dave Korn @ 2008-02-20 21:45 UTC (permalink / raw)
  To: 'About as pretty-printed as yer gonna get.'

On 20 February 2008 20:52, Brian Dessent wrote:

> Dave Korn wrote:
> 
>> is just soooooo much easier and more self-consistent and less typing than
>> 
>>   "%08x", x
> 
> Oh, don't be so hard on C++.  I mean, sure, some things are a little
> clunky, but it makes up for it with such interesting compile errors:
> 
> example.cc:21: conversion from `double' to non-scalar type
>
`map<vector<basic_string<char,string_char_traits<char>,__default_alloc_templat
e<true,0>
>>
,allocator<basic_string<char,string_char_traits<char>,__default_alloc_template
<true,0>
>> > >
>>
>,set<basic_string<char,string_char_traits<char>,__default_alloc_template<true
,0>
>>
>,less<basic_string<char,string_char_traits<char>,__default_alloc_template<tru
e,0>
>> >
>>
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_templat
e<true,0>
>> > >
>>
>,less<vector<basic_string<char,string_char_traits<char>,__default_alloc_templ
ate<true,0>
>>
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_templat
e<true,0>
>> > > >
>>
>,allocator<set<basic_string<char,string_char_traits<char>,__default_alloc_tem
plate<true,0>
>>
>,less<basic_string<char,string_char_traits<char>,__default_alloc_template<tru
e,0>
>> >
>>
>,allocator<basic_string<char,string_char_traits<char>,__default_alloc_templat
e<true,0>
>> > > > > >' requested              
> 
> Brian


  Hey, you cheated, that's been run through that utility that turns C++
gibberish error messages into nice clear clean simple ones, hasn't it?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-20 20:15 Why I love C++ so much Dave Korn
  2008-02-20 20:52 ` Brian Dessent
@ 2008-02-21  1:20 ` Gary R. Van Sickle
  2008-02-21 10:10   ` Dave Korn
  2008-02-21  6:32 ` Václav Haisman
  2 siblings, 1 reply; 20+ messages in thread
From: Gary R. Van Sickle @ 2008-02-21  1:20 UTC (permalink / raw)
  To: 'The Vulgar and Unprofessional Cygwin-Talk List'


> From: Dave Korn
> 
> 
>   Because writing
> 
>   hex << setw (8) << setfill ('0') << ((uintptr_t)(x)) << dec 
> << setfill (' ')
> 
> is just soooooo much easier and more self-consistent and less 
> typing than
> 
>   "%08x", x
> 
> 
> 
> <grrrspit>
> 

Ummm... Kornsy?  All the *printf()'s are available for your use in every
standard C++ library I've ever come across, if you really want to risk the
security and portability problems.

Or are you telling us that you have a C compiler that magically compiles the
bare symbols:

	"%08x", x

into some sort of string and/or output?  That might be cool, but I think
that's Perl ;-).

-- 
Gary R. Van Sickle
 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-20 20:15 Why I love C++ so much Dave Korn
  2008-02-20 20:52 ` Brian Dessent
  2008-02-21  1:20 ` Gary R. Van Sickle
@ 2008-02-21  6:32 ` Václav Haisman
  2008-02-21 10:28   ` Corinna Vinschen
  2 siblings, 1 reply; 20+ messages in thread
From: Václav Haisman @ 2008-02-21  6:32 UTC (permalink / raw)
  To: The Vulgar and Unprofessional Cygwin-Talk List

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

Dave Korn wrote, On 20.2.2008 21:15:
> 
> 
>   Because writing
> 
>   hex << setw (8) << setfill ('0') << ((uintptr_t)(x)) << dec << setfill (' ')
> 
> is just soooooo much easier and more self-consistent and less typing than
> 
>   "%08x", x
C'mon, while it is slightly longer than the sprintf() version for such simple 
thing as printing single hexadecimal number, there are plenty of things 
sprintf() just doesn't offer that you can do with C++ IO streams.


> 
> 
> 
> <grrrspit>
> 
>     cheers,
>       DaveK

--
VH


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-21  1:20 ` Gary R. Van Sickle
@ 2008-02-21 10:10   ` Dave Korn
  2008-02-21 12:10     ` Warren Young
  0 siblings, 1 reply; 20+ messages in thread
From: Dave Korn @ 2008-02-21 10:10 UTC (permalink / raw)
  To: 'The Vulgar and Unprofessional C++-Talk List'

On 21 February 2008 01:18, Gary R. Van Sickle wrote:

>> From: Dave Korn
>> 
>> 
>>   Because writing
>> 
>>   hex << setw (8) << setfill ('0') << ((uintptr_t)(x)) << dec << setfill
>> (' ') 
>> 
>> is just soooooo much easier and more self-consistent and less typing than
>> 
>>   "%08x", x
>> 
>> 
>> 
>> <grrrspit>
>> 
> 
> Ummm... Kornsy?  All the *printf()'s are available for your use in every
> standard C++ library I've ever come across, if you really want to risk the
> security and portability problems.

  Which makes the above monstrosity an even worse waste of time, space and
energy!  I mean look at that shabby mess!  Modal operators!
Non-modal-self-resetting operators!  Inferring the field type from the width
of the integer!

  That's /why/ I end up using those *printfs in C++ all the time.

> Or are you telling us that you have a C compiler that magically compiles the
> bare symbols:
> 
> 	"%08x", x
> 
> into some sort of string and/or output?  That might be cool, but I think
> that's Perl ;-).

  LOFL.  Nah, I was just comparing the equivalent subsequences from debugging
print statements.

  Of course, if you know of a C++ compiler that lets you print into the 'hex'
operator, maybe I know of a C compiler that can infer you mean a printf from a
comma-expression...

  And this is where we came in.  Because /the C++ way/ would be to say "I
know, let's create an overloaded "const char *operator, (int &x)", that treats
the first operand as a format string and the second as a varargs list.  Or
maybe they'd invent templates or something really far-out and bizarre instead.
I dunno, they're mad, all mad I tell you, pronounced
"MAaaaaa-hahuahauaahuaaa-aaad!" and spelt "gibberboinkwibble".

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21  6:32 ` Václav Haisman
@ 2008-02-21 10:28   ` Corinna Vinschen
  2008-02-21 12:27     ` Warren Young
  0 siblings, 1 reply; 20+ messages in thread
From: Corinna Vinschen @ 2008-02-21 10:28 UTC (permalink / raw)
  To: cygwin-talk

On Feb 21 07:32, V?clav Haisman wrote:
> Dave Korn wrote, On 20.2.2008 21:15:
>>   Because writing
>>   hex << setw (8) << setfill ('0') << ((uintptr_t)(x)) << dec << setfill 
>> (' ')
>> is just soooooo much easier and more self-consistent and less typing than
>>   "%08x", x
> C'mon, while it is slightly longer than the sprintf() version for such 
> simple thing as printing single hexadecimal number, there are plenty of 
> things sprintf() just doesn't offer that you can do with C++ IO streams.

Really?  Show me an example which isn't much harder to understand than
the equivalent C code.


Corinna

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21 10:10   ` Dave Korn
@ 2008-02-21 12:10     ` Warren Young
  0 siblings, 0 replies; 20+ messages in thread
From: Warren Young @ 2008-02-21 12:10 UTC (permalink / raw)
  To: The Vulgar and Unprofessional Cygwin-Talk List

Dave Korn wrote:
> 
> /the C++ way/ would be to say "I
> know, let's create an overloaded "const char *operator, (int &x)"....

The C++ Way is to use whatever tool works best for the task at hand. 
That's why Father Stroustrup gave us so many of them.
--
Warren "big C++ advocate who uses *printf() all the time" Young

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21 10:28   ` Corinna Vinschen
@ 2008-02-21 12:27     ` Warren Young
  2008-02-21 13:49       ` Corinna Vinschen
  0 siblings, 1 reply; 20+ messages in thread
From: Warren Young @ 2008-02-21 12:27 UTC (permalink / raw)
  To: cygwin-talk

Corinna Vinschen wrote:
> 
> Really?  Show me an example which isn't much harder to understand than
> the equivalent C code.

template <class T>
std::string foo(const T& x)
{
     std::ostringstream outs;
     outs << x << and << maybe << other << stuff;
     return outs.str();
}

(Aside: This looks pointlessly trivial, but it's a simplified version of 
real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just 
muddy the waters to talk about the reason MySQL++ does this.)

To do that with C functions (maybe strto*() instead of printf()) you'd 
have to create a set of template specializations for every T you know 
about to call the right C function with the right arguments.  Any time 
you add to the list of supported T's, you have to add template 
specializations.

The main thing IOStreams gives you is type safety.  If your types are 
all portable C primitive types and they're known at compile time, by all 
means, use C functions for string conversions.  IOStreams is nearly 
useless if you don't use data types that K&R didn't give you.

This includes not just user-defined types, but also unportable ones like 
the various ways to get a 64-bit integer.  Not all C++ compilers fully 
support C99, so you can't count on having long long.  VC++ uses __int64, 
for instance.  As long as the compiler vendor provides operator <<() for 
the type you want to use, you don't have to introduce more unportable 
facilities to your code to do something like the T-to-string conversion 
above.  The compiler figures out how to do it for you, and if it changes 
in the future, you just recompile.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21 12:27     ` Warren Young
@ 2008-02-21 13:49       ` Corinna Vinschen
  2008-02-22  8:35         ` Danilo Turina
  2008-02-22  9:11         ` Warren Young
  0 siblings, 2 replies; 20+ messages in thread
From: Corinna Vinschen @ 2008-02-21 13:49 UTC (permalink / raw)
  To: cygwin-talk

On Feb 21 05:26, Warren Young wrote:
> Corinna Vinschen wrote:
>> Really?  Show me an example which isn't much harder to understand than
>> the equivalent C code.
>
> template <class T>
> std::string foo(const T& x)
> {
>     std::ostringstream outs;
>     outs << x << and << maybe << other << stuff;
>     return outs.str();
> }
>
> (Aside: This looks pointlessly trivial, but it's a simplified version of 
> real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just 
> muddy the waters to talk about the reason MySQL++ does this.)
>
> To do that with C functions (maybe strto*() instead of printf()) you'd have 
> to create a set of template specializations for every T you know about to 
> call the right C function with the right arguments.  Any time you add to 
> the list of supported T's, you have to add template specializations.

Argh.  Using templates as an example for simplicity is somewhat daring.
Templates, liberally used, are a good way to make code unreadable.

IMHO.

FWIW.

YMMV.

YMCA.


Corinna

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21 13:49       ` Corinna Vinschen
@ 2008-02-22  8:35         ` Danilo Turina
  2008-02-22 16:14           ` Igor Peshansky
  2008-02-22  9:11         ` Warren Young
  1 sibling, 1 reply; 20+ messages in thread
From: Danilo Turina @ 2008-02-22  8:35 UTC (permalink / raw)
  To: cygwin-talk

Corinna Vinschen wrote:
> On Feb 21 05:26, Warren Young wrote:
>> Corinna Vinschen wrote:
>>> Really?  Show me an example which isn't much harder to understand than
>>> the equivalent C code.
>> template <class T>
>> std::string foo(const T& x)
>> {
>>     std::ostringstream outs;
>>     outs << x << and << maybe << other << stuff;
>>     return outs.str();
>> }
>>
>> (Aside: This looks pointlessly trivial, but it's a simplified version of 
>> real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just 
>> muddy the waters to talk about the reason MySQL++ does this.)
>>
>> To do that with C functions (maybe strto*() instead of printf()) you'd have 
>> to create a set of template specializations for every T you know about to 
>> call the right C function with the right arguments.  Any time you add to 
>> the list of supported T's, you have to add template specializations.
> 
> Argh.  Using templates as an example for simplicity is somewhat daring.
> Templates, liberally used, are a good way to make code unreadable.
> 
> IMHO.
> 
> FWIW.
> 
> YMMV.
> 
> YMCA.
> 
> 
> Corinna
> 

C++ is like Unix, people that don't like it is because they don't 
understand it.

Cheers,
		Danilo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-21 13:49       ` Corinna Vinschen
  2008-02-22  8:35         ` Danilo Turina
@ 2008-02-22  9:11         ` Warren Young
  2008-02-22  9:47           ` Michael Schaap
  1 sibling, 1 reply; 20+ messages in thread
From: Warren Young @ 2008-02-22  9:11 UTC (permalink / raw)
  To: cygwin-talk

Corinna Vinschen wrote:
> Templates, liberally used, are a good way to make code unreadable.

*shrug*  Anything can be abused.  There's the old legend about the guy 
who defined a bunch of macros so he could use Pascal (or Fortran, or 
whatever) syntax to write in C.

I've weighed in on both sides of this issue because no single tool is 
suited to everything.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-22  9:11         ` Warren Young
@ 2008-02-22  9:47           ` Michael Schaap
  2008-02-22 13:05             ` Warren Young
  2008-02-22 16:16             ` Igor Peshansky
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Schaap @ 2008-02-22  9:47 UTC (permalink / raw)
  To: The Vulgar and Unprofessional Cygwin-Talk List

On 22-Feb-2008 10:10, Warren Young wrote:
>
> *shrug* Anything can be abused. There's the old legend about the guy 
> who defined a bunch of macros so he could use Pascal (or Fortran, or 
> whatever) syntax to write in C.
>

"the guy"? Not just _some_ guy...
http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/mac.h.html

– Michael

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-22  9:47           ` Michael Schaap
@ 2008-02-22 13:05             ` Warren Young
  2008-02-22 16:16             ` Igor Peshansky
  1 sibling, 0 replies; 20+ messages in thread
From: Warren Young @ 2008-02-22 13:05 UTC (permalink / raw)
  To: The Vulgar and Unprofessional Cygwin-Talk List

Michael Schaap wrote:
> "the guy"? Not just _some_ guy...
> http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/mac.h.html

Actually, I think this particular wheel has been reinvented many times.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-22  8:35         ` Danilo Turina
@ 2008-02-22 16:14           ` Igor Peshansky
  2008-02-22 16:20             ` Dave Korn
  0 siblings, 1 reply; 20+ messages in thread
From: Igor Peshansky @ 2008-02-22 16:14 UTC (permalink / raw)
  To: The Cygwin-Talk Maiming List

On Fri, 22 Feb 2008, Danilo Turina wrote:

> Corinna Vinschen wrote:
> > On Feb 21 05:26, Warren Young wrote:
> > > Corinna Vinschen wrote:
> > > > Really?  Show me an example which isn't much harder to understand than
> > > > the equivalent C code.
> > > template <class T>
> > > std::string foo(const T& x)
> > > {
> > >     std::ostringstream outs;
> > >     outs << x << and << maybe << other << stuff;
> > >     return outs.str();
> > > }
> > >
> > > (Aside: This looks pointlessly trivial, but it's a simplified version of
> > > real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just
> > > muddy the waters to talk about the reason MySQL++ does this.)
> > >
> > > To do that with C functions (maybe strto*() instead of printf()) you'd
> > > have to create a set of template specializations for every T you know
> > > about to call the right C function with the right arguments.  Any time you
> > > add to the list of supported T's, you have to add template
> > > specializations.
> >
> > Argh.  Using templates as an example for simplicity is somewhat daring.
> > Templates, liberally used, are a good way to make code unreadable.
> >
> > IMHO.
> >
> > FWIW.
> >
> > YMMV.
> >
> > YMCA.

"Young men, no need to feel down"...  That brings back memories. :-)

> C++ is like Unix, people that don't like it is because they don't
> understand it.

C++ is for people who want to be able to not just shoot themselves in the
foot, but do it with a rocket launcher.  Unix allows one to throw a
grenade under their own feet.  So yes, they are very similar.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Why I love C++ so much.
  2008-02-22  9:47           ` Michael Schaap
  2008-02-22 13:05             ` Warren Young
@ 2008-02-22 16:16             ` Igor Peshansky
  1 sibling, 0 replies; 20+ messages in thread
From: Igor Peshansky @ 2008-02-22 16:16 UTC (permalink / raw)
  To: The Cygwin-Talk Maiming List

On Fri, 22 Feb 2008, Michael Schaap wrote:

> On 22-Feb-2008 10:10, Warren Young wrote:
> >
> > *shrug* Anything can be abused. There's the old legend about the guy
> > who defined a bunch of macros so he could use Pascal (or Fortran, or
> > whatever) syntax to write in C.
>
> "the guy"? Not just _some_ guy...
> http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/mac.h.html

Heh, Warren did say he was a *legendary* guy...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-22 16:14           ` Igor Peshansky
@ 2008-02-22 16:20             ` Dave Korn
  2008-02-22 16:33               ` Igor Peshansky
  0 siblings, 1 reply; 20+ messages in thread
From: Dave Korn @ 2008-02-22 16:20 UTC (permalink / raw)
  To: 'The Cygwin-Talk Maiming List that turns into a Lobster when
	you try and dress it'

On 22 February 2008 16:14, Igor Peshansky wrote:

> On Fri, 22 Feb 2008, Danilo Turina wrote:
> 
>> Corinna Vinschen wrote:
>>> On Feb 21 05:26, Warren Young wrote:
>>>> Corinna Vinschen wrote:
>>>>> Really?  Show me an example which isn't much harder to understand than
>>>>> the equivalent C code.
>>>> template <class T>
>>>> std::string foo(const T& x)
>>>> {
>>>>     std::ostringstream outs;
>>>>     outs << x << and << maybe << other << stuff;
>>>>     return outs.str();
>>>> }
>>>> 
>>>> (Aside: This looks pointlessly trivial, but it's a simplified version of
>>>> real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just
>>>> muddy the waters to talk about the reason MySQL++ does this.)
>>>> 
>>>> To do that with C functions (maybe strto*() instead of printf()) you'd
>>>> have to create a set of template specializations for every T you know
>>>> about to call the right C function with the right arguments.  Any time
>>>> you add to the list of supported T's, you have to add template
>>>> specializations.
>>> 
>>> Argh.  Using templates as an example for simplicity is somewhat daring.
>>> Templates, liberally used, are a good way to make code unreadable.
>>> 
>>> IMHO.
>>> 
>>> FWIW.
>>> 
>>> YMMV.
>>> 
>>> YMCA.
> 
> "Young men, no need to feel down"...  That brings back memories. :-)

  Didn't bring back the memory of the word "there's", I note!


>> C++ is like Unix, people that don't like it is because they don't
>> understand it.
> 
> C++ is for people who want to be able to not just shoot themselves in the
> foot, but do it with a rocket launcher.  Unix allows one to throw a
> grenade under their own feet.  So yes, they are very similar.

  But it wasn't a rocket-launcher when I picked it up, it was a bar of soap,
it only overloaded itself into a rocket launcher when I tried to wash my feet
with it instead of my hands!

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-22 16:20             ` Dave Korn
@ 2008-02-22 16:33               ` Igor Peshansky
  2008-02-22 16:39                 ` Dave Korn
  0 siblings, 1 reply; 20+ messages in thread
From: Igor Peshansky @ 2008-02-22 16:33 UTC (permalink / raw)
  To: The Cygwin-Talk Maiming List

On Fri, 22 Feb 2008, Dave Korn wrote:

> On 22 February 2008 16:14, Igor Peshansky wrote:
>
> > On Fri, 22 Feb 2008, Danilo Turina wrote:
> >
> >> Corinna Vinschen wrote:
> >>> On Feb 21 05:26, Warren Young wrote:
> >>>> Corinna Vinschen wrote:
> >>>>> Really?  Show me an example which isn't much harder to understand than
> >>>>> the equivalent C code.
> >>>> template <class T>
> >>>> std::string foo(const T& x)
> >>>> {
> >>>>     std::ostringstream outs;
> >>>>     outs << x << and << maybe << other << stuff;
> >>>>     return outs.str();
> >>>> }
> >>>>
> >>>> (Aside: This looks pointlessly trivial, but it's a simplified version of
> >>>> real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would just
> >>>> muddy the waters to talk about the reason MySQL++ does this.)
> >>>>
> >>>> To do that with C functions (maybe strto*() instead of printf()) you'd
> >>>> have to create a set of template specializations for every T you know
> >>>> about to call the right C function with the right arguments.  Any time
> >>>> you add to the list of supported T's, you have to add template
> >>>> specializations.
> >>>
> >>> Argh.  Using templates as an example for simplicity is somewhat daring.
> >>> Templates, liberally used, are a good way to make code unreadable.
> >>>
> >>> IMHO.
> >>>
> >>> FWIW.
> >>>
> >>> YMMV.
> >>>
> >>> YMCA.
> >
> > "Young men, no need to feel down"...  That brings back memories. :-)
>
>   Didn't bring back the memory of the word "there's", I note!

Hey, I didn't say they were *perfect* memories.

> >> C++ is like Unix, people that don't like it is because they don't
> >> understand it.
> >
> > C++ is for people who want to be able to not just shoot themselves in the
> > foot, but do it with a rocket launcher.  Unix allows one to throw a
> > grenade under their own feet.  So yes, they are very similar.
>
>   But it wasn't a rocket-launcher when I picked it up, it was a bar of
> soap, it only overloaded itself into a rocket launcher when I tried to
> wash my feet with it instead of my hands!

No, it was a rocket launcher all along.  It just happened to be an
overloaded "bar of soap" operator.  You should be careful with the type of
the operands...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-22 16:33               ` Igor Peshansky
@ 2008-02-22 16:39                 ` Dave Korn
  2008-02-22 17:04                   ` Dave Korn
  0 siblings, 1 reply; 20+ messages in thread
From: Dave Korn @ 2008-02-22 16:39 UTC (permalink / raw)
  To: 'Do Not Taunt Happy Cygwin-Talk Maiming List'

On 22 February 2008 16:33, Igor Peshansky wrote:

> On Fri, 22 Feb 2008, Dave Korn wrote:
> 
>> On 22 February 2008 16:14, Igor Peshansky wrote:
>> 
>>> On Fri, 22 Feb 2008, Danilo Turina wrote:
>>> 
>>>> Corinna Vinschen wrote:
>>>>> On Feb 21 05:26, Warren Young wrote:
>>>>>> Corinna Vinschen wrote:
>>>>>>> Really?  Show me an example which isn't much harder to understand than
>>>>>>> the equivalent C code.
>>>>>> template <class T>
>>>>>> std::string foo(const T& x)
>>>>>> {
>>>>>>     std::ostringstream outs;
>>>>>>     outs << x << and << maybe << other << stuff;
>>>>>>     return outs.str();
>>>>>> }
>>>>>> 
>>>>>> (Aside: This looks pointlessly trivial, but it's a simplified version
>>>>>> of real code in MySQL++ (http://tangentsoft.net/mysql++/).  It would
>>>>>> just muddy the waters to talk about the reason MySQL++ does this.)
>>>>>> 
>>>>>> To do that with C functions (maybe strto*() instead of printf()) you'd
>>>>>> have to create a set of template specializations for every T you know
>>>>>> about to call the right C function with the right arguments.  Any time
>>>>>> you add to the list of supported T's, you have to add template
>>>>>> specializations.
>>>>> 
>>>>> Argh.  Using templates as an example for simplicity is somewhat daring.
>>>>> Templates, liberally used, are a good way to make code unreadable.
>>>>> 
>>>>> IMHO.
>>>>> 
>>>>> FWIW.
>>>>> 
>>>>> YMMV.
>>>>> 
>>>>> YMCA.
>>> 
>>> "Young men, no need to feel down"...  That brings back memories. :-)
>> 
>>   Didn't bring back the memory of the word "there's", I note!
> 
> Hey, I didn't say they were *perfect* memories.
> 
>>>> C++ is like Unix, people that don't like it is because they don't
>>>> understand it.
>>> 
>>> C++ is for people who want to be able to not just shoot themselves in the
>>> foot, but do it with a rocket launcher.  Unix allows one to throw a
>>> grenade under their own feet.  So yes, they are very similar.
>> 
>>   But it wasn't a rocket-launcher when I picked it up, it was a bar of
>> soap, it only overloaded itself into a rocket launcher when I tried to
>> wash my feet with it instead of my hands!
> 
> No, it was a rocket launcher all along.  It just happened to be an
> overloaded "bar of soap" operator.  You should be careful with the type of
> the operands...
> 	Igor


  My desert polish just overloaded itself into a floor-topping :-(



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: Why I love C++ so much.
  2008-02-22 16:39                 ` Dave Korn
@ 2008-02-22 17:04                   ` Dave Korn
  0 siblings, 0 replies; 20+ messages in thread
From: Dave Korn @ 2008-02-22 17:04 UTC (permalink / raw)
  To: 'The Vulgar and Poorly-Spelled Cygwin-Talk List'

On 22 February 2008 16:39, Dave Korn wrote:



>   My desert polish just overloaded itself into a floor-topping :-(

       ^^^^^^ dessert

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-02-22 17:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-20 20:15 Why I love C++ so much Dave Korn
2008-02-20 20:52 ` Brian Dessent
2008-02-20 21:45   ` Dave Korn
2008-02-21  1:20 ` Gary R. Van Sickle
2008-02-21 10:10   ` Dave Korn
2008-02-21 12:10     ` Warren Young
2008-02-21  6:32 ` Václav Haisman
2008-02-21 10:28   ` Corinna Vinschen
2008-02-21 12:27     ` Warren Young
2008-02-21 13:49       ` Corinna Vinschen
2008-02-22  8:35         ` Danilo Turina
2008-02-22 16:14           ` Igor Peshansky
2008-02-22 16:20             ` Dave Korn
2008-02-22 16:33               ` Igor Peshansky
2008-02-22 16:39                 ` Dave Korn
2008-02-22 17:04                   ` Dave Korn
2008-02-22  9:11         ` Warren Young
2008-02-22  9:47           ` Michael Schaap
2008-02-22 13:05             ` Warren Young
2008-02-22 16:16             ` Igor Peshansky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).