6 ms·
Yes. There is no undefined behavior in Odin (afaik), and I haven’t seen many monoletter identifiers. There is a slice type and a for … in loop statement so that
by krig 1y ago
Yes. There is no undefined behavior in Odin (afaik), and I haven’t seen many monoletter identifiers. There is a slice type and a for … in loop statement so that gets rid of most i:s and j:s.
- tialaramex 1y ago> There is no undefined behavior in Odin This mostly just ends up meaning that Odin's creator Ginger Bill will engage in pointless semantic arguments in which he defines away your problem. There are places where C could reasonably have chosen to define what happens, or to make it Unspecified rather than Undefined, and so that's what Odin chooses, which is a meaningful benefit. However there are plenty of situations left in which what you've written would be UB in C and absolutely anything might happen, while in Odin absolutely anything might happen but Bill insists it isn't UB.
- krig 1y agoWell, without concrete examples this just sounds childish TBH. But I haven’t looked very closely at it myself, hence the afaik qualifier.
- tialaramex 1y agoSo as a concrete example: https://odin.godbolt.org/z/8onn4hxP1 https://odin.godbolt.org/z/8onn4hxP1 This brief example makes a hash map, then it demonstrates that if we call a sub-routine which makes its own distinct hash map, that doesn't change ours, but, once we destroy our hash map and call the sub-routine again, we can still use the variable for our (destroyed) hash map (!) but doing so reveals the contents of that other hash map from the sub-routine instead in the cases I saw. Now, in C or C++ if you do this that's Undefined Behaviour and the symptoms I saw (and which you're likely to see if you follow the link) are just one of arbitrarily many ways that could manifest. In Rust of course the equivalent code won't compile because the hash map is gone so we can't just go around using it after that. And in Odin, well, as Ginger Bill has explained Odin does not have Undefined Behaviour so... this has behaviour which er, Odin has not defined ? Does that make you feel warm and tingly or do you feel like Bill just wasted time arguing semantics?
- krig 1y agoWell, sure. If that’s what you mean by having UB then it’s trivially true for any language with a C FFI for example, or rust with unsafe. I guess what I consider UB is when the compiler exploits UB for optimizations, like discarding code that could invoke UB, which as far as I know odin doesn’t do.
- jibal 1y ago> I guess what I consider UB is when the compiler exploits UB for optimizations, like discarding code that could invoke UB, which as far as I know odin doesn’t do. This statement is incoherent. UB is undefined behavior, and it existed long before any compiler exploited it and isn't (circularly) defined by whether the Odin compiler exploits it.
- krig 1y agoWell, the statement is circular, colloquial speech doesn't have to be coherent. It's my understanding of what people generally mean when they complain about UB in the C standard, and it seems to be what gingerbill means too. My take on what he is saying is that the odin compiler won't try to exploit that there is some behavior which is platform-defined or only knowable at runtime to do aggressive optimizations etc. https://xcancel.com/TheGingerBill/status/1495004577531367425 https://xcancel.com/TheGingerBill/status/1495004577531367425 To point out that use after free is possible in Odin is not really a gotcha unless you really are just arguing semantics. That's by design, just like use after free is possible in C or C++ or Rust too.
- jibal 1y agoYour understanding is completely wrong. UB means "undefined behavior" -- behavior that is not specified by the language standard or the implementation. UB being exploited by the compiler is a separate issue. Saying that there is no UB is saying that there's no undefined behavior; it is certainly not merely saying that the compiler doesn't exploit it. I programmed in C for over 30 years and was a member of the C Standards Committee, which originated the language about undefined behavior ... I know what I'm talking about. > To point out that use after free is possible in Odin is not really a gotcha unless you really are just arguing semantics. That's by design, just like use after free is possible in C or C++ or Rust too. This completely misses the point and is a failure to understand at every level. Being able to use memory after being freed is not by design -- no one intends it, no one wants it. It's undefined behavior, and a program that does it is buggy. The reason that it's possible is because it's so hard to detect or prevent. To do so requires escape analysis, lifetime declarations, borrow checking, etc. etc. And no, use after free is not possible in Rust--not in safe code. It's hard to respond to that statement without being rude, so I will say no more.
- jibal 1y ago> Well, without concrete examples this just sounds childish TBH. Please don't be pointlessly insulting. The description matches many people's experience.
- krig 1y agoI'm not the one throwing baseless accusations around. "He was mean to me once" isn't that interesting, especially without anything concrete to back it up.
- jibal 1y agoFirst, that's whataboutism. Second, you are, actually. And what the other fellow said is not at all baseless, and he did back it up. GB is well known for being argumentative, highly opinionated, and rude. But people make allowances for those who put in the work, and GB certainly does.
- gingerBill 1y agoMe being "well known" in general is news to me. However, the people I am that way are usually people like yourself. I am argumentative with people like yourself, however I try not to be "rude" but I am not always "nice". I think this is probably a cultural distinction where I make a distinction between Niceness and Politeness. Rudeness is the not-being-polite, rather than not-being-nice. As for my "highly opinionated" things, honestly, I don't think I am that opinionated about many things, but I guess the ones I am on, they are the "well known" aspects. If I am wrong about something, I will gladly change my opinion given a good argument or set of facts.
- krig 1y agoFirst, no it isn't. What baseless accusation did I make? I haven't seen the conversations he is referring to, he didn't link to or quote anything. It's just some general complaint about Bill, which may be true but who cares?
- 1y ago