Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > is C++ worth it ?

Reply
Thread Tools

is C++ worth it ?

 
 
Noah Roberts
Guest
Posts: n/a
 
      08-06-2012
On Monday, July 30, 2012 12:59:17 AM UTC-7, Stuart wrote:

> For example, I start to tend to favour Java over C++ because whenever I
>
> make some grave mistake and get a Memory Access Violation, this is more
>
> or less the end of the world for a C++ application. Java, in contrast,
>
> nicely captures this and gives me an exception. This not only makes me
>
> able to shut down gracefully, but also provides me with enough error
>
> information about where I went wrong (there is no standard way under C++
>
> to retrieve the stacktrace of an exception). I don't understand why such
>
> a feature is not important enough to make it into the C++ standard,
>
> while such gimmicks like lambdas and whatnot get huge attention.


To a great degree this kind of feature IS in the standard. The vector 'at'function for example throws an exception if bounds are violated. This is all Java does.

The main difference here is that C++ doesn't impose this upon you. The 'at' function is provided for times when you really need to do bounds checkingand other operations are provided for when you really do not.

I think the problem comes when people pay too much attention to the C part of C++. Raw arrays and such are mostly a thing of the past in C++. There's no really good reason to use them outside of a backward compatibility scenario. I believe the library provided abstractions are even quite competitive in the high-performance, micro-optimization niche.
 
Reply With Quote
 
 
 
 
Nick Keighley
Guest
Posts: n/a
 
      08-07-2012
On Aug 6, 6:45*pm, Noah Roberts <(E-Mail Removed)> wrote:
> On Monday, July 30, 2012 12:59:17 AM UTC-7, Stuart wrote:
> > For example, I start to tend to favour Java over C++ because whenever I

>
> > make some grave mistake and get a Memory Access Violation, this is more

>
> > or less the end of the world for a C++ application. Java, in contrast,

>
> > nicely captures this and gives me an exception. This not only makes me

>
> > able to shut down gracefully, but also provides me with enough error

>
> > information about where I went wrong (there is no standard way under C++

>
> > to retrieve the stacktrace of an exception). I don't understand why such

>
> > a feature is not important enough to make it into the C++ standard,

>
> > while such gimmicks like lambdas and whatnot get huge attention.

>
> To a great degree this kind of feature IS in the standard. *The vector 'at' function for example throws an exception if bounds are violated. *This is all Java does.
>
> The main difference here is that C++ doesn't impose this upon you. *The'at' function is provided for times when you really need to do bounds checking and other operations are provided for when you really do not.
>
> I think the problem comes when people pay too much attention to the C part of C++. *Raw arrays and such are mostly a thing of the past in C++. *There's no really good reason to use them outside of a backward compatibility scenario. *I believe the library provided abstractions are even quite competitive in the high-performance, micro-optimization niche.


low level programming? Interfacing to hardware?
 
Reply With Quote
 
 
 
 
boltar2003@boltar.world
Guest
Posts: n/a
 
      08-07-2012
On Mon, 6 Aug 2012 10:45:33 -0700 (PDT)
Noah Roberts <(E-Mail Removed)> wrote:
>I think the problem comes when people pay too much attention to the C part =
>of C++. Raw arrays and such are mostly a thing of the past in C++. There'=


Not if you do any low level or network programming.

>nario. I believe the library provided abstractions are even quite competit=
>ive in the high-performance, micro-optimization niche.


For quite competetive read not as fast as.

B2003

 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-07-2012
On Tue, 2012-08-07, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> On Mon, 6 Aug 2012 10:45:33 -0700 (PDT)
> Noah Roberts <(E-Mail Removed)> wrote:
>>I think the problem comes when people pay too much attention to the C part =
>>of C++. Raw arrays and such are mostly a thing of the past in C++. There'=

>
> Not if you do any low level or network programming.


OK, but there's no excuse not to isolate and encapsulate arrays so
they are largely invisible. If you want potential buffer overflows
everywhere, you might as well use C.

>>nario. I believe the library provided abstractions are even quite competit=
>>ive in the high-performance, micro-optimization niche.

>
> For quite competetive read not as fast as.


Given the beginner's mistake you did with std::set in another current
thread[0], your opinion doesn't have much weight yet. Work with the
library for a year or so, and you may change your mind.

/Jorgen

[0] <jvr9u8$tgb$(E-Mail Removed)>

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Stefan Ram
Guest
Posts: n/a
 
      08-07-2012
Noah Roberts <(E-Mail Removed)> writes:
>To a great degree this kind of feature IS in the standard. The vector 'at' function for example throws an exception if bounds are violated. This is all Java does.
>The main difference here is that C++ doesn't impose this upon you. The 'at' function is provided for times when you really need to do bounds checking and other operations are provided for when you really do not.


It turns out that programmers are notoriously bad at
estimating when bounds checking is needed. Otherwise, there
would be far less buffer overrun exploits. Java can detect
certain situations where it can statically prove that
bounds checking is not needed and then omit dynamical bounds
checking for those cases it. Some people are posting to a
technical newsgroup and then can't even control their line
lengths to be less than about 72.

 
Reply With Quote
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-07-2012
On Tuesday, August 7, 2012 2:19:56 PM UTC-4, Jorgen Grahn wrote:

>
> Given the beginner's mistake you did with std::set in another current
>
> thread[0], your opinion doesn't have much weight yet. Work with the
>
> library for a year or so, and you may change your mind.
>
>


Perhaps he normally uses an alternative to ::std::set.
I prefer Boost Intrusive's rbtree

http://www.boost.org/doc/libs/1_50_0..._multiset.html

to ::std::map or ::std::set.


Brian
Ebenezer Enterprises
http://webEbenezer.net


I'm not endorsing Romney, but I hope people are
aware of what a loser Obama is by now.
 
Reply With Quote
 
Tobias Müller
Guest
Posts: n/a
 
      08-08-2012
Stefan Ram <(E-Mail Removed)-berlin.de> wrote:
> Noah Roberts <(E-Mail Removed)> writes:
>> To a great degree this kind of feature IS in the standard. The vector
>> 'at' function for example throws an exception if bounds are violated.
>> This is all Java does.
>> The main difference here is that C++ doesn't impose this upon you. The
>> 'at' function is provided for times when you really need to do bounds
>> checking and other operations are provided for when you really do not.

>
> It turns out that programmers are notoriously bad at
> estimating when bounds checking is needed. Otherwise, there
> would be far less buffer overrun exploits. Java can detect
> certain situations where it can statically prove that
> bounds checking is not needed and then omit dynamical bounds
> checking for those cases it. Some people are posting to a
> technical newsgroup and then can't even control their line
> lengths to be less than about 72.


To rely on the assumption that lines don't exceed 80 chars is like using a
static buffer of size 80 without bounds checking -- an anachronism.

The limit of 72 chars for top level comments feels like: "Let's restrict
top level comments to 72 chars, then we are on safe side. Nobody will ever
need more than 8 citation levels."

I use an intelligent newsreader, that just displays everything correctly,
no matter what's the length of a line.
Actually, the only problems come from readers/writers that think they must
break every line after 80 chars, no matter if it's part of a quote. Even
worse, most of them don't even insert quotation marks for the newly created
line. This leads to unreadable text.

Tobi
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      08-08-2012
Stefan Ram wrote:

> It turns out that programmers are notoriously bad at
> estimating when bounds checking is needed. Otherwise, there
> would be far less buffer overrun exploits. Java can detect
> certain situations where it can statically prove that
> bounds checking is not needed and then omit dynamical bounds
> checking for those cases it. Some people are posting to a
> technical newsgroup and then can't even control their line
> lengths to be less than about 72.


That's only a problem if your usenet client is buggy. Meanwhile, there are
plenty of usenet clients that were adequately developed, and therefore don't
suffer from that limitation.


Rui Maciel
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-08-2012
On Wed, 2012-08-08, Rui Maciel wrote:
> Stefan Ram wrote:
>
>> It turns out that programmers are notoriously bad at
>> estimating when bounds checking is needed. Otherwise, there
>> would be far less buffer overrun exploits. Java can detect
>> certain situations where it can statically prove that
>> bounds checking is not needed and then omit dynamical bounds
>> checking for those cases it. Some people are posting to a
>> technical newsgroup and then can't even control their line
>> lengths to be less than about 72.

>
> That's only a problem if your usenet client is buggy. Meanwhile, there are
> plenty of usenet clients that were adequately developed, and therefore don't
> suffer from that limitation.


We have been through this a number of times before. What you call a
"buggy" client is what others call "supports Usenet conventions and
netiquette". It's hard to do anything about that.

(That said, I wish SR hadn't brought Usenet length limits into a
completely unrelated discussion.)

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
boltar2003@boltar.world
Guest
Posts: n/a
 
      08-09-2012
On 7 Aug 2012 18:19:56 GMT
Jorgen Grahn <(E-Mail Removed)> wrote:
>On Tue, 2012-08-07, (E-Mail Removed) wrote:
>> On Mon, 6 Aug 2012 10:45:33 -0700 (PDT)
>> Noah Roberts <(E-Mail Removed)> wrote:
>>>I think the problem comes when people pay too much attention to the C part =
>>>of C++. Raw arrays and such are mostly a thing of the past in C++. There'=

>>
>> Not if you do any low level or network programming.

>
>OK, but there's no excuse not to isolate and encapsulate arrays so
>they are largely invisible. If you want potential buffer overflows
>everywhere, you might as well use C.


If you know the exact size of the data you're dealing with , eg a packet
header, then you won't get any buffer overflows because you'll only ever
read in that amount.

>> For quite competetive read not as fast as.

>
>Given the beginner's mistake you did with std::set in another current


What beginners mistake? I was quite well aware of the built in find() in
set, I'd just never used the standard version on it and was surprised it
wasn't optimised.

>thread[0], your opinion doesn't have much weight yet. Work with the
>library for a year or so, and you may change your mind.


Thanks, I've been using it for 10 years or so. Go take your patronising
bullshit somewhere else.

B2003

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worth buying modem router? =?Utf-8?B?QmFkQW5nbGVy?= Wireless Networking 2 07-05-2005 02:33 PM
How much is Bill worth right now? Me_and_you ASP .Net 18 02-12-2005 03:21 AM
Market worth? Nickolas Microsoft Certification 2 12-10-2004 12:06 AM
Is it worth it? Russ McKenna ASP .Net 5 12-06-2003 06:47 PM
MCSE Cert. Is it still worth it? Dominique Feteau Microsoft Certification 3 11-05-2003 08:43 PM



Advertisments