Hacker Newsnew | past | comments | ask | show | jobs | submit | tekne's commentslogin

Have you considered Docker?

Fellow Typst user for my PhD thesis, can concur.

Land value tax?

Wait... yes they do.

If I raise the price of my product, less people will buy it but I'll make more profit per-unit -- so the amount of money I make is an inverted U with price on the x axis and money on the y axis, and I should set the price at the inflection point.


Obligatory land value tax mention

One of the best things about it IMO -- or we'd be spending the next hundred years waiting for copyright reform


No, that's actually UB. The important bit here is "compiler defined" -- UB means the compiler is allowed to assume it never happens while compiling.

Consider, for example, an implementation defined function f() -- which can also diverge/crash horribly, etc.

If I write

    if p {
      print("p is true")
    } else {
      g()
    }

    if p {
      f()
    }
Then either we: - print p is true and execute f - do nothing

This is true regardless of if f immediately crashes the computer, nasal demons, whatever -- that's implementation defined.

UB means f may never happen.

And that means the compiler may optimize this to just:

    g()
Notice the difference here -- the print never happens!, and g always happens.

You can see why this is concerning when you write code like

    if dry_run {
      print("would run rm -rf /")
    } else {
      run("rm -rf /")
    }

    if dry_run {
      // oops: some_debug_string is NULL and will segfault!
      print(some_debug_string);
    }


I see what you're going for, but I don't see how your example is UB. If `p` is a pointer, and, after your `if (p)` check, `p` is dereferenced unconditionally, then yes, your check for `p == NULL` could be removed, and the code under the `if` would be removed as well. But the example you've constructed is not UB.


You misunderstood their example, I think.

If doesn't matter what 'p' is in their example. The point is: if 'f' is undefined behavior (rather than just impl-defined), then the optimizer concludes that the "if p { f() }" can never happen... which means that we're allowed to assume that 'if p { ... } else { ... }' (in the first part of the example) will always take the else branch. The compiler will optimize accordingly and just always call g() unconditionally.


Something something capability-based finance something something


I mean... if it's got a similar amount of toxin X to drinking water... then it's probably not making things much worse.

There is lead in dirt!


The upper limit does not mean that water actually has that amount in it regularly.


I mean... you can use an encryption scheme compatible with this (if you know the password).

I suppose this makes some sense for home computers (burglars and police raids are rare) but for a laptop, you really don't want thieves getting all your details.

Ironically -- this probably was paranoid a few years ago, but now -- "ChatGPT, use this prepared prompt to extract all useful info from this hard drive"


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

Search: