I have a struct:
struct ShortResume {
let age: Int32
let hasVehicle: Bool
}
When I do print(MemoryLayout<ShortResume>.size), it prints out 5, that is correct: Int32 occupies 4 bytes and Bool occupies 1 byte.
Then I change my struct to this:
struct ShortResume {
let age: Int32?
let hasVehicle: Bool
}
it prints out 6, that is also correct, because optional occupies 1 byte in memory.
However, when I change my struct to this:
struct ShortResume {
let age: Int32?
let hasVehicle: Bool?
}
it prints out 6 again, but it must be 7, because there are two optionals now.
Why? Maybe I'm missing something?