User: Password:
|
|
Subscribe / Log in / New account

Should be: Goodnight, Perl 6.

Should be: Goodnight, Perl 6.

Posted Feb 15, 2013 22:33 UTC (Fri) by efraim (guest, #65977)
In reply to: Should be: Goodnight, Perl 6. by marcH
Parent article: Chromatic: Goodnight, Parrot

While you are right that there are many gotchas in C++ which can trip newbies, pointers are pretty easy to get right by simple ownership rules:

1. If you get a shared_ptr or unique_ptr you can store it for use later.

2. Otherwise (if you get a raw pointer or a reference) you have to assume that you do not own the resource and can only use it in the method's scope.

3. By calling .get() you are saying you are going to take care of ensuring the object's existence during your use of the pointer - i.e. you get no help all bets are off.

Moreover other languages have much more subtle traps in basic parts of language than C++ does - look at JavaScript and PHPs type-casting rules - while wildly different, both are very counter-intuitive and prone to creating security issues.


(Log in to post comments)

Should be: Goodnight, Perl 6.

Posted Feb 16, 2013 1:01 UTC (Sat) by marcH (subscriber, #57642) [Link]

I know nothing about JavaScript besides this funny description I've read some day: a functional language disguised behind curly brackets and some object-orientation not to scare away people afraid of maths :-)

http://javascript.crockford.com/javascript.html

You are probably right about JavaScript dangers. On the other hand, I know enough about PHP not to even consider it as programming language. Otherwise the differences between all other languages become negligible and they all become equally excellent

http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad...


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds