[{"data":1,"prerenderedAt":377},["ShallowReactive",2],{"project-8886842":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":33,"aspects":34,"strip":43,"post_text":45,"what":46,"said":100,"maker_in_thread":186,"shape":195,"grid":198,"attempts":339,"same_week":340,"maker_shows":39,"maker_hidden":369,"reader_version":370,"card":371},"8886842","c-smart-pointers","Smart pointers for the C programming language","title","Show HN: Smart pointers for the C programming language","https:\u002F\u002Fgithub.com\u002FSnaipe\u002Fc-smart-pointers","github.com","Snaipe",1421249806,2015,126,58,183,2565,8,"notable","languages","c libraries","library",[24,25,26,27],"c smart pointers","raii in c","memory management","gcc cleanup attribute","debated",-0.124,{"positive":31,"neutral":18,"mixed":32,"critical":18},6,0,22,{"design":35,"idea":38,"execution":40,"docs":41,"performance":42},{"positive":36,"critical":37},1,2,{"positive":39,"critical":36},3,{"positive":36,"critical":36},{"positive":36,"critical":32},{"positive":32,"critical":36},[32,32,32,32,32,32,32,36,32,44,36,39,32,32,32,32,44,32,39,36,32,39,39,36,44,32,44,32,44,36,36,39,39,39,32,39,36,32,32,39],5,null,{"problem":47,"audience":57,"pricing":45,"motivation":65,"time_to_build":45,"stack":69,"openness":97,"stage":98,"team_size":99},{"value":48,"source":49,"evidence":50},"Automatic memory management for C, emulating RAII and smart pointers.","maker",[51,54],{"id":52,"by":11,"text":53},"8887367","I guess it's more about writing less & better than using known functions -- in the same reasoning, I \u002Fcould\u002F use new\u002Fdelete in C++, but I always end up using unique_ptr\u003CT>(...)…",{"id":55,"by":11,"text":56},"8891409","I pretty much explain all that in the article[1], but here is the gist of it: * I implemented smalloc and sfree to respectively allocate and deallocate a memory block with…",{"value":58,"source":59,"evidence":60},"C programmers who want automatic memory cleanup.","inferred",[61],{"id":62,"by":63,"text":64},"8887590","tormeh","It is pretty impressive, actually. C, in general, does not have nice things. And it seems like this is on purpose. I think you're supposed to use C++ if you want nice things on…",{"value":66,"source":49,"evidence":67},"Explore modern idioms in C; a proof of concept, mostly a toy project.",[68],{"id":52,"by":11,"text":53},[70,76,83,91],{"value":71,"source":49,"evidence":72},"C",[73],{"id":74,"by":11,"text":75},"8887503","I've only been actively programming in C for the past three years, so I'm not that much informed either, but from my researches on the subject, I haven't seen any. The probable…",{"value":77,"source":49,"evidence":78},"GCC\u002FClang attributes",[79,82],{"id":80,"by":11,"text":81},"8887034","GCC and Clang specific, as said in the readme page. I know, apply.h is ugly, but I did not want to lose too much time on that (and it was easy to dump these lines from a shell…",{"id":55,"by":11,"text":56},{"value":84,"source":85,"evidence":86},"Autotools","commenter",[87],{"id":88,"by":89,"text":90},"8888531","endgame","It's also a case study on how to make a tidy project using the autotools. The only thing I'd change is to commit a 0-byte m4\u002F.keep file and then remove autogen.sh in favour of…",{"value":92,"source":49,"evidence":93},"Python (test suite)",[94],{"id":95,"by":11,"text":96},"8889059","I have to polish a bit my python test suite, but it's coming ;)","open_source","prototype","unknown",{"praise":101,"objections":114,"requests":148,"questions":159,"alternatives":170},[102,110],{"value":103,"source":85,"evidence":104},"Interesting proof of concept for RAII in C",[105,106],{"id":62,"by":63,"text":64},{"id":107,"by":108,"text":109},"8887576","dahart","I give it a thumbs up on the basis of the FAQ.",{"value":111,"source":85,"evidence":112},"Tidy autotools project",[113],{"id":88,"by":89,"text":90},[115,126,133,141],{"value":116,"source":85,"evidence":117},"Relies on GCC\u002FClang-specific features, not standard C",[118,122],{"id":119,"by":120,"text":121},"8886968","falcolas","Looks to be GCC specific, using several GCC specific variable attributes. Quite a bit of preprocessor macro magic as well. Also, my succinct and unprofessional response to…",{"id":123,"by":124,"text":125},"8887529","kazinator","This relies on support in the GCC infrastructure. That support is there thanks to the back-end support for C++. Calling it \"for the C language\" is misleading, insinuating…",{"value":127,"source":85,"evidence":128},"Valgrind already solves leak detection",[129],{"id":130,"by":131,"text":132},"8887291","aninteger","This is really neat, but I actually wonder if we aren't trying to solve a mostly solved problem. As a C programmer, yes, sometimes you forget to free memory that you've…",{"value":134,"source":85,"evidence":135},"Abstraction hurts readability and debugging",[136,137],{"id":130,"by":131,"text":132},{"id":138,"by":139,"text":140},"8887358","Igglyboo","Isn't the whole point of C to have as minimal abstraction as possible?",{"value":142,"source":85,"evidence":143},"No tests yet",[144],{"id":145,"by":146,"text":147},"8888793","jahan-addison","My trust in actually using this even for personal reasons would go 100x had you have written tests",[149,153],{"value":150,"source":85,"evidence":151},"Add tests",[152],{"id":145,"by":146,"text":147},{"value":154,"source":85,"evidence":155},"Support C++ target or portable approach",[156],{"id":157,"by":124,"text":158},"8889252","You can make smart pointers which are not specific to a GNU language. Here is how: doh, use C++. Let's see, ISO C++ portable smart pointers? Or GNU\u002FLLVM C smart pointers? If all…",[160,166],{"value":161,"source":85,"evidence":162},"Does it work with longjmp?",[163],{"id":164,"by":165,"text":161},"8892566","aidenn0",{"value":167,"source":85,"evidence":168},"How does the recursion limit in apply.h behave?",[169],{"id":119,"by":120,"text":121},[171,175,182],{"value":172,"source":85,"evidence":173},"Valgrind leak checking",[174],{"id":130,"by":131,"text":132},{"value":176,"source":85,"evidence":177},"Boehm garbage collector",[178,179],{"id":74,"by":11,"text":75},{"id":180,"by":124,"text":181},"8888760","Side story: I witnessed a situation in which an embedded board had to be manufactured in a variant supporting a bigger DRAM chip, just so there would be room to run Valgrind on…",{"value":183,"source":85,"evidence":184},"C++ unique_ptr",[185],{"id":52,"by":11,"text":53},{"comments":187,"answered":188,"key":189},16,7,[190,193,194],{"id":191,"text":192},"8887397","Not really, otherwise even the standard library would not exist, and we would manually ask pages to the kernel every time we want memory. C, as a language, is indeed low level,…",{"id":52,"text":53},{"id":80,"text":81},{"commenters":196,"max_depth":18,"maker_replies":187,"first_comment_mins":37,"lifespan_hours":197},30,40,[199,201,205,206,208,211,213,217,218,221,224,226,228,231,234,238,241,242,245,247,249,251,253,255,259,261,264,266,267,269,273,276,279,280,283,284,287,289,291,293,295,297,299,300,304,308,309,312,314,316,318,320,325,327,330,333,336],[130,32,32,200,131,32],"commenter\u002Fcritical\u002Fidea",[202,32,32,203,204,32],"8887330","commenter\u002Fneutral\u002Fidea","minthd",[138,32,32,203,139,32],[191,32,32,207,11,36],"commenter\u002Fneutral\u002Fnone",[209,32,32,207,210,32],"8888723","Retra",[52,32,32,212,11,36],"project\u002Fneutral\u002Fidea",[214,32,32,215,216,32],"8888937","other\u002Fneutral\u002Fnone","cpeterso",[180,32,32,215,124,32],[219,32,32,207,220,32],"8889626","kansface",[222,32,32,207,223,32],"8891635","pjmlp",[119,36,36,225,120,32],"project\u002Fcritical\u002Fnone",[80,36,32,227,11,36],"project\u002Fneutral\u002Fexecution",[229,36,44,230,204,32],"8887158","project\u002Fpositive\u002Fdesign",[232,36,32,233,11,36],"8887181","project\u002Fneutral\u002Fdesign",[235,36,36,236,237,32],"8887312","project\u002Fcritical\u002Fdesign","TheLoneWolfling",[239,36,32,240,11,36],"8887418","project\u002Fneutral\u002Fnone",[157,36,39,233,124,32],[243,36,32,207,244,32],"8889691","__david__",[246,36,32,215,124,32],"8890497",[248,36,32,215,244,32],"8891362",[250,36,32,215,124,32],"8895379",[252,36,32,215,244,32],"8897710",[254,37,32,240,11,36],"8886863",[256,37,44,257,258,32],"8888776","project\u002Fpositive\u002Fidea","eatonphil",[260,37,32,215,11,36],"8889101",[262,37,39,240,263,32],"8888870","sepeth",[265,37,32,240,11,36],"8889089",[123,39,36,225,124,32],[268,39,32,212,11,36],"8887588",[270,271,32,215,272,32],"8888759",4,"yason",[274,44,39,212,275,32],"8887468","CardenB",[277,44,39,212,278,32],"8887490","nanofortnight",[74,44,32,212,11,36],[281,44,36,225,282,32],"8887922","asveikau",[62,44,44,257,63,32],[285,44,32,215,286,32],"8888242","ANTSANTS",[288,44,32,215,63,32],"8892737",[88,31,44,290,89,32],"project\u002Fpositive\u002Fexecution",[292,31,32,215,11,36],"8888564",[294,31,32,215,89,32],"8895371",[107,188,44,296,108,32],"project\u002Fpositive\u002Fdocs",[145,18,36,298,146,32],"project\u002Fcritical\u002Fexecution",[95,18,32,227,11,36],[301,302,36,236,303,32],"8889727",9,"mpu",[305,306,39,212,307,32],"8891179",10,"rileymat",[55,306,32,227,11,36],[310,306,39,311,307,32],"8893629","maker\u002Fneutral\u002Fdocs",[164,313,39,227,165,32],11,[315,313,32,227,11,36],"8892633",[317,313,39,227,165,32],"8893867",[319,313,32,227,11,36],"8895013",[321,322,36,323,324,32],"8887410",12,"project\u002Fcritical\u002Fidea","jheriko",[326,322,32,212,11,36],"8887441",[328,322,32,207,329,32],"8887975","dicroce",[331,322,32,207,332,32],"8888024","evincarofautumn",[334,322,36,335,223,32],"8891654","project\u002Fcritical\u002Fperformance",[337,322,44,257,338,32],"8888013","koenigdavidmj",[],[341,346,351,356,361,365],{"id":342,"name":343,"points":344,"category":345},"8888089","blessed-contrib",305,"dev_tools",{"id":347,"name":348,"points":349,"category":350},"8869305","LoveActualize",252,"consumer_social",{"id":352,"name":353,"points":354,"category":355},"8857632","sideprojects.assembly.com",175,"web_saas",{"id":357,"name":358,"points":359,"category":360},"8882197","Powder",107,"games",{"id":362,"name":363,"points":364,"category":355},"8886588","Youth Service Network (ysnmn.org)",100,{"id":366,"name":367,"points":368,"category":345},"8881090","Slalom",96,false,"v2",{"id":372,"name":5,"line":6,"ai":369,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":373,"top":18,"kw":374,"maker":11,"domain":10,"tier":19,"attempts":32,"strip":375,"url":9,"mix":376,"praise":103,"objection":116,"sub":21},8886842,-0.12,[24,25,26,27],"0000000105130000503103315050511333031003",[31,18,32,18],1794036527337]