But Swift compiles to machine code that has no concept of bool (smallest addressable memory is 1 byte on most platforms). What am I missing?
-
-
-
It compiles down to an i1 in LLVM, which is the same underlying representation as Bool. If it shows up in a struct, it’ll probably be 1-byte aligned and it’ll be loaded and compared against 0b00000001
- Još 1 odgovor
Novi razgovor -
-
-
What is ‘basically’?
-
It’s not actually a Bool, in the Swift sense. It’s an i1 at the LLVM level.
- Još 3 druga odgovora
Novi razgovor -
-
-
In retrospect, of course they do. But it’s cool to see that.
Prikaži ovu nitHvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
That's pretty bool
Hvala. Twitter će to iskoristiti za poboljšanje vaše vremenske crte. PoništiPoništi
-
-
-
Bool: Enum{ Public override length = 2; }
-
No lie, Twitter flagged this as a potentially offensive Tweet in my feed.
- Još 1 odgovor
Novi razgovor -
-
-
Does that mean 1 byte, or 1 bit? (for struct-packing purposes, I mean)
-
Ok, I checked and it's the former. I'm not sure why this is surprising and/or cool then I guess? I mean, you can create an enum of up to 256 cases and that will also fit in a single byte, so…?
- Još 1 odgovor
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.