[Novalug] C++ "news"

Varol Okan varokan@movingsatellites.com
Sun Jun 19 11:13:47 EDT 2011


Happy Fathers day every one ...

Just caught up on my e-mail and wanted to give technical feedback more 
then keeping this thread alive. It was a good thread though.

"." vs "->" is something that comes automatic and you don't even think 
about this anymore. It helps reading your code.

"friend" helps in a couple of cases. I use it mostly for sub-classes. 
However, say you design an interface ( API ) and you want to release a 
clean API, you declare as much private as you can, while exposing only 
what is required. But when you write this E.g. Library you might want to 
create a couple more classes to design based on your underlying ( maybe 
physical ) object model.
So a friend class allows you to do achieve both.

Passing by pointer vs passing by reference: Most of the time it does not 
really matter, however sometimes it is easier ( less typing ) to pass by 
pointer. Of course the very first thing you should do check for NULL 
pointers in your function.

BTW, I love multiple inheritance, especially coupled with template 
classes will give you a powerful tool to build upon ... But that might 
be personal preference.

Also I read up on the Garbage collection and it seems that by now GCs 
are as fast as malloc/new. So no complaints there aside from the 
generally larger memory footprint, which might cause headaches on 
embedded devices ... but that's another story.

The reason we keep C++ around is 98% because of legacy code in 
production, and because C++ is a very good programming language.

Anyhow, got to get back to my family ...

Varol :)

On 06/17/2011 12:53 PM, James Ewing Cottrell 3rd wrote:
> I'd say Yes and No. Given that C++ is (mostly) upwardly compatible 
> with C, I'd rather see C itself just plain Go Away. In fact, back in 
> Bell Labs they referred to C++ as "C" and C as "old C".
>
> Features can be used gradually...they don't have to be used all at 
> once. If C itself were to die, then C++ could evolve out of the evil 
> compromises it made for compatibility.
>
> I find the correspondence between pointers and arrays, pointers in 
> general and references to be maddening and intolerable. The idea of a 
> Reference to an Object a la Java, Python, and Ruby is much cleaner.
>
> And qualification is simply done with ".", never a "->".  Oh...and 
> tell me again why we need the "friend" keyword when no other language 
> seems to? Maybe to avoid mixins?
>
> And I definitely like Interfaces over Multiple Inheritance. Then 
> again, if you inherit from a (second) class that has only abstract 
> member functions...I guess you get the same thing.
>
> I still think that the reason we keep C++ around is for its 
> speed...after all, garbage collection can really kill a program. But 
> then again, I really haven't kept up with C++. Stroustrup's first 
> book, in 1987, was about 300 pages, not all that much thicker than K&R 
> at about 200. His second book, in 1995 had doubled to 600. I never did 
> do much more than scan his third, as I was writing in Perl mostly, and 
> until recently (this millennia) it seemed that few UNIX/Linux people 
> were writing C++ either.
>
> JIM
>
> On 6/17/2011 11:53 AM, Andrew Beals wrote:
>> More C than C++ and in many places there's no reason for the code to 
>> be C++ in the first place, aside from laziness in the forms of not 
>> wanting to declare variables ahead of time or in their proper scope, 
>> not wanting to deal with memory allocation, or not wanting to 
>> actually think about what needs to be done and declaring a singular 
>> "class" to pull things together.
>>
>> On Sun, Jun 12, 2011 at 10:49 PM, Subba Rao 
>> <castellan2004-novalug@yahoo.com 
>> <mailto:castellan2004-novalug@yahoo.com>> wrote:
>>
>>     I did notice the C++ in majority of the open source tools.  From
>>     my customer's vantage point, it is C# that is hot.
>>
>>     Nice to know.  Thank you fo the link.
>>
>>     Subbarao
>>
>>     --- On *Sun, 6/12/11, Ed James /<edward.james@gmail.com
>>     <mailto:edward.james@gmail.com>>/* wrote:
>>
>>
>>         From: Ed James <edward.james@gmail.com
>>         <mailto:edward.james@gmail.com>>
>>         Subject: [Novalug] C++ "news"
>>         To: novalug@calypso.tux.org <mailto:novalug@calypso.tux.org>
>>         Date: Sunday, June 12, 2011, 1:55 PM
>>
>>
>>         I, for one, welcome our new C++0x overloads.
>>
>>         Ed James
>>
>>         http://www.theregister.co.uk/2011/06/11/herb_sutter_next_c_plus_plus/
>>         _______________________________________________
>>         Novalug mailing list
>>         Novalug@calypso.tux.org
>>         <http://mc/compose?to=Novalug@calypso.tux.org>
>>         http://calypso.tux.org/mailman/listinfo/novalug
>>
>>
>>     _______________________________________________
>>     Novalug mailing list
>>     Novalug@calypso.tux.org <mailto:Novalug@calypso.tux.org>
>>     http://calypso.tux.org/mailman/listinfo/novalug
>>
>>
>>
>> _______________________________________________
>> Novalug mailing list
>> Novalug@calypso.tux.org
>> http://calypso.tux.org/mailman/listinfo/novalug
>
>
>
> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20110619/9836a051/attachment.htm>


More information about the Novalug mailing list