[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology

View post   

[ Toggle deleted replies ]
File: 65 KB, 960x720, 1445878138804.jpg [View same] [iqdb] [saucenao] [google] [report]
65231795 No.65231795 [Reply] [Original] [archived.moe] [rbt]

>C++ library
>It uses shared pointers

>> No.65232169
File: 164 KB, 413x352, 1474373650932.png [View same] [iqdb] [saucenao] [google] [report]

>only one dependency
>the dependency is boost

>> No.65232199

What is the problem with either of those?
I mean most of boost things are mostly there because you want to be able to compile it with an old compiler and shared pointers are useful in libraries.

>> No.65232201
File: 66 KB, 528x792, 1512664978810.jpg [View same] [iqdb] [saucenao] [google] [report]

>C library
>casts the return value of malloc

>> No.65232383
File: 88 KB, 750x725, 1504421848555.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.65233125 [DELETED] 

What do you plan on doing with a void*?

>> No.65233143

Implicit conversion

>> No.65233151

you don't need to explicitly cast void* in c

>> No.65233250

not OP, but I would think that using shared_ptr<> etc. in interfaces implies really sloppy ownership semantics in the API.

returning unique_ptr<> implies that the caller is the one true owner and that the API doesn't maintain weird ambiguous ownership in the background sometimes.

I guess you could also look at it as an idiot flag, i.e., the designer doesn't have a clear understanding of ownership at all and want to wave shared_ptr<> around like a pseudo-GC magic wand.

>> No.65234935

Why not return make_shared<T>(args) then?

>> No.65236055


Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.