Hacker News new | past | comments | ask | show | jobs | submit | 6equj5's comments login

> 229 If a builder builds a house for someone, and does not construct it properly, and the house which he built falls and kills its owner, then that builder shall be put to death.

http://faculty.collin.edu/mbailey/hammurabi%27s%20laws.htm


Thus the builders guild began to charge 50 silver for insurrance yearly from its members, which resulted to all road projects having a yearly 100 silver talent cost-addition on start. 5 years after the code, the empire went bankrupt


And you're not opposed to try-catch boilerplate?


Boilerplate is code you have to write almost as a pro forma thing. If (in go lang, to continue my example) you're just going to keep copy pasting the same if statement to return `err` up to some higher caller, then why write all those lines when at the top level a single try/catch can remove potentially dozens of lines of code?


> And yet, most of the time when somebody even realises they shouldn't write codecs (and file compression and various other similar technologies) in C++ their next guess is Rust which while obviously an improvement over C++ is hardly a good choice for this work either.

Not C++ nor Rust?! What then, tia? C? Ada??


It's certainly a conundrum isn't it. What programming language should we use for Wrangling Untrusted File Formats Safely ?

https://github.com/google/wuffs


To me, the point of it is just to be more explicit and ease maintenance, like `typedef int meters_t`, but more extensible. Compare `int foo_len` to `meters_t foo_len`.

Explicitness: Consider the ambiguousness of `int foo_len` when you're swapping between meters and feet (but use `int` for both).

Ease maintenance: If you want to change the type you use to represent meters (say from `int` to `size_t`, since it might be wise to make it unsigned), compare going through the code and changing each meter-related instance of `int` vs. just changing the `meters_t` struct declaration.

More extensible: Compared to `typedef int meters_t`, using a struct is useful if you ever have to add to the struct. (Maybe a second numeric member representing the conversion to some other unit of length or something.)

For "meters", this doesn't really apply, but using a struct also prevents you from accidentally trying to do math with numeric types that you shouldn't do math with (like ID numbers or something): https://stackoverflow.com/a/18876104/9959012

Also, you probably shouldn't use `_t` at the end since that should be reserved by the C standard and by POSIX: https://stackoverflow.com/a/231807/9959012


Where I work, the C++ style guide explicitly says not to alias int types like this cause it becomes annoying for others to keep looking up what each thing really is, and probably YAGNI. I agree with that recommendation.

Any int variable storing meters is probably called "meters" already.


Even John Carmack thinks "writing good code" is impossible: https://youtu.be/I845O57ZSy4?t=1351 ; p


I can second Effective Modern C++: https://www.oreilly.com/library/view/effective-modern-c/9781...

The most amazing thing about it is how it manages to be so entertaining to read (the last thing I expected from a C++ textbook and a thing that made getting through it way easier)!

>I'm not sure if there's an even more recent edition that covers C++17 and C++20

Sadly, there is not. Scott for-the-most-part retired in 2015: https://scottmeyers.blogspot.com/2015/12/good-to-go.html



The cytoplasm of those are very interesting. It has multiple partitions, and the cytoplasm is very viscous. They don't "pop" if there is damage or leak all their contents into the water. They can repair some amount of damage.


>A thought has been lately put forward, which may or may not have truth in it. What if — instead of Jupiter being a world, inhabited by animals and people, as is often supposed, with a small distant sun and five dim moons to give them light — what if Jupiter is himself in some sort a second sun to his moons, and what if those "moons" are really inhabited planets? It may be so. That is all we can say. The idea is not an impossible one. (p. 207)

And that's still all we can say about at least one of them[0]. :)

0: https://en.wikipedia.org/wiki/Europa_(moon)#Habitability_pot...


Hopefully playing games on every platform that supports a browser[0].

0: https://wasm.continuation-labs.com/d3demo/


Firefox, µBlock Origin, and NoScript: the holy trinity. ;p


Just an FYI, NoScript is made largely redundant with uBlock Origin since if you enable the "I am an advanced user" checkbox in it's settings, it will allow you to selectively block or allow third party scripts and frames.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: