[HN Gopher] Orthodox C++ ___________________________________________________________________ Orthodox C++ Author : generichuman Score : 15 points Date : 2020-12-27 20:32 UTC (2 hours ago) (HTM) web link (gist.github.com) (TXT) w3m dump (gist.github.com) | kllrnohj wrote: | This is rather awful. | | The concept isn't terrible necessarily, but the execution and | condescension sure is. And some of the rules are just pointlessly | argumentative. Such as refusing to use <cstdio> and instead using | <stdio.h> - those are officially documented to be different | things with different behaviors. Blanket banning one of them | doesn't improve simplicity, especially if you're blanket banning | the "wrong" set of headers. Unless the goal is to also ban | namespaces, but that's not called out as such (and namespaces are | one of the least contentions C++ features - everyone seems to | like them well enough). | | Or similarly: | | > Don't use anything from STL that allocates memory, unless you | don't care about memory management. | | So don't use std::vector? Or std::unordered_map? Or std::string? | These are all perfectly fine classes, banning them makes no sense | at all. Maybe the goal was to ban "hidden cost" classes like | std::function, but rolling your own 'C-style' is a _hell_ of a | lot more complex & error prone (raise your hand if you've seen a | C pointer callback that forgot to have a void* context or a | mismanagement of said void* context...) | tomohawk wrote: | I thought this was a good point: | | > Don't do this: | http://archive.md/2014.04.28-125041/http://www.boost.org/doc... | | Maybe he is looking to use golang? | amelius wrote: | That's actually a very good example of what's wrong with C++'s | templates and also shows how we got there. | MaxBarraclough wrote: | Interesting idea, pity about the name. There's a vaguely similar | effort with a similarly poor choice of name, _Clean C++_ , which | is guaranteed to compile as both C and C++ with the same | behaviour (provided there's no undefined behaviour or platform- | specific behaviour). [0][1] | | > Exception handling is the only C++ language feature which | requires significant support from a complex runtime system, and | it's the only C++ feature that has a runtime cost even if you | don't use it | | I don't think that's true. I believe that if you enable RTTI you | pay for it even if you don't use it, which is why it's banned in | the LLVM codebase. [2] | | > Don't use C++ runtime wrapper for C runtime includes (<cstdio>, | <cmath>, etc.), use C runtime instead (<stdio.h>, <math.h>, etc.) | | I believe this is still supported, but is officially deprecated, | for what that's worth. [3] | | [0] | http://www.qnx.com/developers/docs/qnxcar2/index.jsp?topic=%... | | [1] https://stackoverflow.com/a/9695020/ | | [2] https://llvm.org/docs/CodingStandards.html#do-not-use- | rtti-o... | | [3] https://stackoverflow.com/a/13643019/ ___________________________________________________________________ (page generated 2020-12-27 23:00 UTC)