Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Smart pointers

Name: Anonymous 2012-05-31 14:52

What does /prog/ think of smart pointers?

Name: Anonymous 2012-05-31 15:09

What do smart pointers think of /prog/?

Name: Anonymous 2012-05-31 17:10

>>2
they are too smart to care about /prog/

also /prog/ is shit! acording to them

Name: Anonymous 2012-06-01 9:45

>>1
As a C++ programmer, I think they are nice.

Name: !r4lisp/Hag 2012-06-01 10:09

They're good for directed acyclic graphs. Stack memory, tracing garbage collectors and manual memory management are better for other purposes.

Name: Anonymous 2012-06-01 11:23

on a scale from 1 to 10 i would rate them a "meh"

Name: Anonymous 2012-06-01 12:34

They're great. You should always use them unless you have an explicit reason not to. You can always go back and change them to raw pointers.

Name: Anonymous 2012-06-01 13:24

Smart pointers, for stupid programmers.

Name: Anonymous 2012-06-01 13:48

>>8
Enjoy your exception unsafe leaky code, luddite.

Name: Anonymous 2012-06-01 14:01

Poor man's GC, or retarded man's high level language?

Name: Anonymous 2012-06-01 14:06

>>9
example to >>8

Name: Anonymous 2012-06-01 15:43

Smart pointers are smarter than most of their users

Name: Anonymous 2012-06-01 17:41

Name: Anonymous 2012-06-02 4:31

>>13
one day, after looking up from the ashes of a double nested cyclic backwards up pointer destroyer auto self intertwined destructor callback cascade, you may appreciate explicit code for simple tasks.

Name: Anonymous 2012-06-02 6:18

C++ is just Common Lisp done wrong.

Name: Cudder !MhMRSATORI!FBeUS42x4uM+kgp 2012-06-02 7:03

>>14
I agree with this completely. It applies even more when you have to debug something that fails somewhere inside the 'hidden' code the compiler automatically generates.

C doesn't have this problem because it's limited in terms of automatically generating code. With C++, things like constructor and destructor calls are generated automatically, and composing deeply nested objects with lots of composition can increase this hidden complexity to surprisingly high levels. Add templated classes (consisting of templated members and superclasses), and it multiplies even more.

Hiding complexity may make things look simpler on the surface, but frustrates understanding of the code, an essential point when debugging. Moreover, the concept of "informed decisions", another important aspect of why C is used --- because it lets the programmer understand the implications of her code easily --- by definition is based upon having knowledge of such details. C++ makes this slightly more difficult due to the autogenerated code, C++11 is going to make it worse.

When auto x = something() looks nearly the same as int x = something(), when a "smart pointer" looks nearly the same as a regular pointer, you've lost that information. Without that information, you've lost the ability to make an informed decision.

The aforementioned new features make it much easier to create lots of code, but make it correspondingly harder to understand it.

"With great power comes great responsibility."

Name: Anonymous 2012-06-02 7:22

>>16
so are you saying smart pointers are bad if you are a bad programmer that lot's of bugs?

Name: Anonymous 2012-06-02 8:38

>>16
The higher level languages are easier to optimise for a compiler because the compiler can apply different techniques for more abstract code. C++ is a special case where this rule doesn't apply because C++ is a clusterfuck of features.

Name: Anonymous 2012-06-02 9:06

>>17
Could-er is a silly, silly person, but you are an even sillier person Anonymous.

You are more silly than a person that has a whitespace in his name, now that is silly!

Name: Anonymous 2012-06-02 10:19

>>18
0/10

Name: Anonymous 2012-06-02 11:41

>>16
her code
Stopped reading right there. Use Spivak pronouns.

Name: Anonymous 2012-06-02 11:42

check em

Name: Anonymous 2012-06-02 12:35

>>22
nice dubz bro. I hope I can get such delicious dubz in my life

Name: Anonymous 2012-06-02 12:41

well hmm i wonder what smart pointers are

>In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking.

>automatic garbage collection or bounds checking.

hahahahahahahahaha

y dose my thing have mem leak/??? seg fault WTF??? btr use smart ptrs 2 b safe...

Name: Anonymous 2012-06-02 15:21

What's a pointer? Why do I need them?

Name: Anonymous 2012-06-02 15:25

Name: Anonymous 2012-06-02 16:29

>>17
it doesn't take much to accidentally trigger a double nested cyclic backwards up pointer destroyer auto self intertwined destructor callback cascade.

>>20
It's actually true. In seeples, the decision to use a pointer, a reference counted pointer, or unique pointer, or allocation on the stack, is a decision that you must make, and your design must remain completely consistent with this decision.

In a memory managed language, you create some kind of object and use it for a while, and possibly pass around references to it. If no references are able to escape the body of the function, the compiler can allocate the object on the stack. If it can be shown that no cyclic references back to the object can occur, then reference counting is sufficient. This is guaranteed when the object contains no reference to other objects, or if all referenced objects are immutable, and the references were all initialed once when the object was created. These are easy for the compiler to determine when these concepts are a part of the language. But there are times when reference counting works, but is more difficult to verify. Unique pointers are shit.

Name: Anonymous 2012-06-03 22:50

Would /prog/ consider it good practice to use shared_ptr everywhere while you're developing/debugging, and then when you're ready to ship, go back and carefully convert them to new'd and delete'd raw pointers?

Name: Anonymous 2012-06-03 22:59

>>28
don't you think if a human could do that and not fuck it up, a computer might be able to as well?

Name: Anonymous 2012-06-04 20:57

>>29
yeah but it's more time efficient because you don't have to fuck around with memory while working on problems; you can focus on memory later

Name: Anonymous 2012-06-04 20:58

>>30
disregard that, i suck cocks

Name: Anonymous 2012-06-05 11:30

Smart pointers are for idiots.

Preallocate large linear blocks of memory and use homogenous arrays for optimal cache usage. Use the standard malloc/free heap functions elsewhere for the small amount of data that doesn't have strict and easily determinable life spans.

http://gamesfromwithin.com/data-oriented-design

Name: Anonymous 2012-06-05 11:34

smart doubles

Name: Anonymous 2013-08-31 7:47


His continuum hypothesis is the proposition that ???? is the same as ℵ1. This hypothesis has been found to be independent of the standard axioms of mathematical set theory; it can neither be proved nor disproved from the standard assumptions.

Name: Anonymous 2013-08-31 7:48

null laser pointers

Name: Anonymous 2013-08-31 8:32


The continuum hypothesis (CH) states that there are no cardinals strictly between ℵ0 and 20. The latter cardinal number is also often denoted by ????; it is the cardinality of the continuum (the set of real numbers). In this case 20 = ℵ1. The generalized continuum hypothesis (GCH) states that for every infinite set X, there are no cardinals strictly between | X | and 2| X |. The continuum hypothesis is independent of the usual axioms of set theory, the Zermelo-Fraenkel axioms together with the axiom of choice (ZFC).

Name: Anonymous 2013-08-31 9:17


Physicists however require that the end result be physically meaningful. In quantum field theory infinities arise which need to be interpreted in such a way as to lead to a physically meaningful result, a process called renormalization.

Name: Anonymous 2013-08-31 10:03


General set theory, a small fragment of Zermelo set theory sufficient for the Peano axioms and finite sets;

Name: Anonymous 2013-08-31 10:48


ZF set theory does not formalize the notion of classes. They can instead be described in the metalanguage, as equivalence classes of logical formulas. For example, if \mathcal A is a structure interpreting ZF, then the metalanguage expression \{x\mid x=x \} is interpreted in \mathcal A by the collection of all the elements from the domain of \mathcal A; that is, all the sets in \mathcal A. So we can identify the "class of all sets" with the predicate x=x or any equivalent predicate.

Don't change these.
Name: Email:
Entire Thread Thread List