[{"data":1,"prerenderedAt":320},["ShallowReactive",2],{"project-5883504":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":34,"aspects":35,"strip":40,"post_text":43,"what":44,"said":65,"maker_in_thread":168,"shape":177,"grid":181,"attempts":281,"same_week":282,"maker_shows":41,"maker_hidden":312,"reader_version":313,"card":314},"5883504","offbrand_lib","C library of generic, reference-counted data structures","title","Show HN: C library of generic, reference-counted data structures","http:\u002F\u002Ftheck01.github.io\u002Foffbrand_lib\u002F","theck01.github.io","theck01",1371260589,2013,91,40,259,1739,15,"notable","languages","c data structure library","library",[24,25,26,27],"c library","reference counting","data structures","generic containers","mixed",-0.032,{"positive":31,"neutral":32,"mixed":33,"critical":32},3,4,2,13,{"design":36,"performance":38,"idea":39},{"positive":37,"critical":33},0,{"positive":37,"critical":37},{"positive":33,"critical":33},[31,31,37,37,37,37,37,37,31,41,41,37,37,37,42,37,31,37,42,37,31,37,31,37,42,41,37,37,37,37,37,37,37,37,37,37,41,37,37,37],1,5,null,{"problem":45,"audience":43,"pricing":43,"motivation":51,"time_to_build":43,"stack":57,"openness":63,"stage":63,"team_size":64},{"value":46,"source":47,"evidence":48},"Generic, reference-counted data structures for C","maker",[49],{"id":50},"post",{"value":52,"source":47,"evidence":53},"Started after tiring of implementing data structures in C classes; became interesting in its own right",[54],{"id":55,"by":11,"text":56},"5885103","I just graduated, so most of the data structures are still pretty fresh in my mind. I started after getting tired of implementing data structures in my many C based classes,…",[58],{"value":59,"source":60,"evidence":61},"C","inferred",[62],{"id":50},"unknown","solo",{"praise":66,"objections":86,"requests":115,"questions":127,"alternatives":142},[67,75],{"value":68,"source":69,"evidence":70},"Nice to see a portable, modern CF-like C library","commenter",[71],{"id":72,"by":73,"text":74},"5884260","comex","A small observation: CoreFoundation typedefs CFTypeRef (the generic object type) to void * , rather than having obj * be a separate type as in this library. This lets you pass…",{"value":76,"source":69,"evidence":77},"Good to see data structures in C; tests are a plus",[78,82],{"id":79,"by":80,"text":81},"5884549","canadev","I've been meaning to refresh and expand both my algorithms knowledge and my C programming with a project like this, myself (as an application developer I find I've barely used…",{"id":83,"by":84,"text":85},"5884100","talloaktrees","Glad to see this.",[87,101,111],{"value":88,"source":69,"evidence":89},"Naming convention and global namespace pollution (unprefixed function names)",[90,94,98],{"id":91,"by":92,"text":93},"5884481","mappu","Was there a rationale to choosing performActionOnStruct() names instead of the perhaps-more-idiomatic struct_perform_action() style? I strongly advise against putting identifiers…",{"id":95,"by":96,"text":97},"5885272","huhtenberg","I find that the decision to adopt a C library for a project frequently boils down to whether it is using a compatible naming notation. Especially for simpler libraries. Linked…",{"id":99,"by":92,"text":100},"5887806","> Putting ob at the beginning of every function seems like overkill That's \"C-style namespaces\" - really the only sane way to avoid an identifier collision, sorry.",{"value":102,"source":69,"evidence":103},"Avoid reference counting overhead; prefer intrusive structures",[104,108],{"id":105,"by":106,"text":107},"5884376","cmccabe","It's nice that you made these available. You might also want to look at queue.h from BSD (see http:\u002F\u002Ffxr.watson.org\u002Ffxr\u002Fsource\u002Fsys\u002Fqueue.h) and tree.h…",{"id":109,"by":106,"text":110},"5897445","Well, this is a good effort. I think you are quite right to leave out reference counting. Reference counting is something that you should pay for only if you need it. I don't…",{"value":112,"source":69,"evidence":113},"Too slow for cases needing specialization",[114],{"id":72,"by":73,"text":74},[116,123],{"value":117,"source":69,"evidence":118},"Allow custom allocators",[119],{"id":120,"by":121,"text":122},"5884347","enqk","I would suggest offering the ability to plug custom allocators.",{"value":124,"source":69,"evidence":125},"Provide a safer cast macro or avoid void pointer typing",[126],{"id":72,"by":73,"text":74},[128,135],{"value":129,"source":69,"evidence":130},"Why avoid C99 _Bool",[131],{"id":132,"by":133,"text":134},"5886827","icodestuff","Definitely forking this to provide a saner API. And some of the implementation is a little iffy (like objIsOfClass). But in general, very cool. Thanks for contributing to the C…",{"value":136,"source":69,"evidence":137},"What are classes built from functions and incomplete types",[138],{"id":139,"by":140,"text":141},"5884441","pepijndevos","What are \"class[es] built from functions and incomplete types\"? I once built classes using structs and function pointers, but this sounds different?",[143,147,154,161],{"value":144,"source":69,"evidence":145},"BSD queue.h and tree.h",[146],{"id":105,"by":106,"text":107},{"value":148,"source":69,"evidence":149},"uthash",[150],{"id":151,"by":152,"text":153},"5884453","rdtsc","I personally like and use uthash (no reference counting) but: * only a header file * has hash, array, string, list, implementations https:\u002F\u002Fgithub.com\u002Fned14\u002Futhash",{"value":155,"source":69,"evidence":156},"CCAN",[157],{"id":158,"by":159,"text":160},"5884411","obiterdictum","Along the same lines, there is also CCAN. http:\u002F\u002Fccodearchive.net\u002Flist.html https:\u002F\u002Fgithub.com\u002Frustyrussell\u002Fccan And GMP for arbitrary precision math (integers and floating point…",{"value":162,"source":69,"evidence":163},"GLib and GMP",[164],{"id":165,"by":166,"text":167},"5884492","jzwinck","I was interested to know how this compares with existing C libraries, so I \"ported\" the prime number example program to use GMP and GLib instead. It's not quite working yet (see…",{"comments":42,"answered":31,"key":169},[170,173,176],{"id":171,"text":172},"5885080","Shoot, if I had known someone was going to do this I would have made the prime number program a bit more efficient. Since it looks like you've ported the algorithm exactly it…",{"id":174,"text":175},"5885096","Some bad habits from Java are the only reason. I thought about having obrelease and obgetCString. Putting ob at the beginning of every function seems like overkill, and I don't…",{"id":55,"text":56},{"commenters":178,"max_depth":42,"maker_replies":42,"first_comment_mins":179,"lifespan_hours":180},25,174,200,[182,184,186,188,192,195,197,199,201,203,205,206,208,210,214,217,219,221,223,227,231,234,236,237,241,244,246,249,251,253,257,260,261,263,267,270,272,275,277,279],[72,37,31,183,73,37],"project\u002Fmixed\u002Fdesign",[165,41,31,185,166,37],"project\u002Fneutral\u002Fperformance",[171,41,37,187,11,41],"maker\u002Fneutral\u002Fperformance",[189,33,37,190,191,37],"5884065","other\u002Fneutral\u002Fnone","andrewcooke",[193,33,37,190,194,37],"5884230","jessedhillon",[196,33,37,190,191,37],"5885012",[198,33,37,190,80,37],"5884543",[200,33,37,190,191,37],"5884987",[158,31,31,202,159,37],"project\u002Fneutral\u002Fnone",[95,32,41,204,96,37],"project\u002Fcritical\u002Fdesign",[91,42,41,204,92,37],[174,42,37,207,11,41],"maker\u002Fneutral\u002Fdesign",[99,42,37,209,92,37],"commenter\u002Fneutral\u002Fdesign",[211,212,37,190,213,37],"5884455",6,"McUsr",[79,215,42,216,80,37],7,"project\u002Fpositive\u002Fidea",[55,215,37,218,11,41],"maker\u002Fneutral\u002Fidea",[132,220,31,183,133,37],8,[151,222,37,190,152,37],9,[224,225,42,216,226,37],"5884291",10,"simgidacav",[228,229,37,190,230,37],"5884150",11,"songgao",[139,232,31,233,140,37],12,"project\u002Fneutral\u002Fdesign",[235,232,37,207,11,41],"5885106",[120,34,31,233,121,37],[238,34,37,239,240,37],"5884933","other\u002Fneutral\u002Fdesign","ambrop7",[83,242,42,243,84,37],14,"project\u002Fpositive\u002Fnone",[105,18,41,245,106,37],"project\u002Fcritical\u002Fidea",[247,18,37,190,248,37],"5884579","wrl",[250,18,37,190,106,37],"5895450",[252,18,37,190,248,37],"5926793",[254,18,37,255,256,37],"5884591","other\u002Fcritical\u002Fdesign","ExpiredLink",[258,18,37,239,259,37],"5884644","pmjordan",[109,18,37,239,106,37],[262,18,37,239,259,37],"5911337",[264,18,37,265,266,37],"5886199","other\u002Fneutral\u002Fperformance","nitrogen",[268,18,37,265,269,37],"5886755","zht",[271,18,37,265,266,37],"5886873",[273,18,41,245,274,37],"5884604","mtdewcmu",[276,18,37,239,240,37],"5884816",[278,18,37,239,274,37],"5891823",[280,18,37,207,11,41],"5885090",[],[283,288,293,298,303,308],{"id":284,"name":285,"points":286,"category":287},"5902927","Ultimate Tic Tac Toe",160,"games",{"id":289,"name":290,"points":291,"category":292},"5900772","We're releasing SoundBrush",155,"creative",{"id":294,"name":295,"points":296,"category":297},"5890983","tunnelsup.com",139,"security_privacy",{"id":299,"name":300,"points":301,"category":302},"5873442","Invoice-o-matic",128,"web_saas",{"id":304,"name":305,"points":306,"category":307},"5901251","Morning",110,"productivity",{"id":309,"name":310,"points":311,"category":302},"5895065","Infraprint",90,false,"v2",{"id":315,"name":5,"line":6,"ai":312,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":316,"top":18,"kw":317,"maker":11,"domain":10,"tier":19,"attempts":37,"strip":318,"url":9,"mix":319,"praise":68,"objection":88,"sub":21},5883504,-0.03,[24,25,26,27],"3300000031100050305030305100000000001000",[31,32,33,32],1793990895367]