Ah, it seems a bigger problem: any pointer parameter (with type const void*
or void*
) in ucrt
is becoming Optional
. Then why only memcmp
crashes the compiler?
UPDATE: Guess what? It turns out that only memcmp
is having the correct signature in ucrt
!
C:\Users\stevapple\swift-test>type x.swift
import ucrt
print("memcmp: \(type(of: memcmp))")
print("memcpy: \(type(of: memcpy))")
C:\Users\stevapple\swift-test>.\x.exe
memcmp: (UnsafeRawPointer, UnsafeRawPointer, Int) -> Int32
memcpy: (Optional<UnsafeMutableRawPointer>, Optional<UnsafeRawPointer>, Int) -> Optional<UnsafeMutableRawPointer>