Optional initiation on Calendar

(Leo) #1

Hi there, I am working on a big-endian platform. I have tried to initiate a calendar optional instance with nil, as the following code shows

import Foundation
var ca: Calendar? = nil

However, it emits a seg fault when printing.

The reason is that the tag byte of nil is written to the high byte instead of the low byte of ca's address, due to the endianness difference. In order to get this fixed, i need to look into the compiler source code where it writes the tag. Does anybody know what source code i should look into?


(Tony Parker) #2

Is it also the case that something like this crashes?

var foo: String? = nil

(Leo) #3

Hi Tony, there is no crash for String?, only for Calendar?.