Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
it happen if we importing os module and cast integer to char.
without importing os module, compilation succeed.
only happened on macosx, not on linux and windows.
Example
import os
proc abc(output: var string) =
let p = 65'u16
output[0] = char(p and 255)
var m = "hello"
abc(m)
echo m
Current Output
Error: execution of an external compiler program 'clang -c -w -I/Users/jangko/Downloads/nim/lib -I/Users/jangko/nimPNG -o /Users/jangko/.cache/nim/oop_d/@moop.nim.c.o /Users/jangko/.cache/nim/oop_d/@moop.nim.c' failed with exit code: 1
/Users/jangko/.cache/nim/oop_d/@moop.nim.c:320:52: error: use of undeclared identifier 'mode_t'
(*output)->data[((NI) 0)] = ((NIM_CHAR)chckRange((mode_t)(p & ((NI) 255)), 0, 255));
^
1 error generated.
Expected Output
Aello
Additional Information
it compile fine with Nim version 0.19.x
link to related issue: jangko/nimPNG#33
$ nim -v
Nim Compiler Version 1.0.99 [MacOSX: amd64]
Compiled at 2019-09-27
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: f804245087615c8258386d211f9c6f27a10191cb
active boot switches: -d:release
I found something more concrete: it only become problem if Mode defined as uint/16/32. if defined as int/16/32 it will be ok.
I have feeling it also related to chckRange.
it happen if we importing os module and cast integer to char. without importing os module, compilation succeed. only happened on macosx, not on linux and windows.
Example
Current Output
Expected Output
Additional Information
it compile fine with Nim version 0.19.x link to related issue: jangko/nimPNG#33