Re: Variables alignment

2016-08-28 Thread Krux02
As far as I know compilers always align your variables unless you specify that you have other priorities, for example with the [packed pragma](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#foreign-function-interface-packed-pragma). For stack variables I don't know it, but I also

Re: Variables alignment

2016-08-28 Thread sheosi
Krux02, from what I've read about lockfree (namely Jeff Preshing's blog: [http://preshing.com](http://forum.nim-lang.org///preshing.com)/ ), one requirement for atomics in x86 (and other architectures) are aligned variables. And about the types anything from 1 to four bytes. Araq,I have

Re: zeroMem can't use?

2016-08-28 Thread stisa
Nim has implicit initialization ( [http://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#statements-and-expressions-var-statement) ) so: var x : array[10,char] echo repr x # ['\0', '\0', '\0',

Re: Reflections on Nim and using it at work

2016-08-28 Thread bogen
Well, strictly speaking, these are not Posix. >From the Linux man page: ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌─┬───┬┐ │Interface

Re: Reflections on Nim and using it at work

2016-08-28 Thread bogen
Alright, this is what I got working for the posix stuff: {.passL: "-lutil".} var SIGWINCH* {.importc, header: "".}: cint var TIOCGWINSZ* {.importc, header: "".}: cuint var TIOCSWINSZ* {.importc, header: "".}: cuint proc openpty (amaster, aslave : ptr int,

zeroMem can't use?

2016-08-28 Thread Angluca
win10, nim0.14.2 # use alloc0 var inputs = cast[array[10,int]](alloc0(sizeof(int) * 10)) inputs[0] = 1 inputs[1] = 2 inputs[2] = 3 for i in 0..9: echo inputs[i] echo repr inputs var test = alloc0(10) zeroMem(test, 10) echo repr

Re: Improved Complex number string representation

2016-08-28 Thread mihirparadkar
Every language with complex number support seems to have its own representation of them. Python does 1 + 2j R does 0+1i Julia does 0.0 + 1.0im Nim seems to follow the same convention as C++ std::complex with (0.0, 1.0) I don't

var parameter

2016-08-28 Thread h42
Can I assume that a var parameter will always be a pointer where I can use (addr varParm) as copymem destination. It seems to work but I can copy to tempory local variable and use normal assignment if there is no guarentee it will always work.

Re: Send data structures between threads?

2016-08-28 Thread Varriount
@Araq This sounds like object mapping, in which data from a database is mapped into a set of objects. That's quite common, and makes working with data much easier.

Re: Send data structures between threads?

2016-08-28 Thread Araq
> So what do you do: do you tell these teams not to use refs? Or do you tell > them to go ahead and use refs and garbage collection, and deal with the > consequences? To be honest I would fire teams who model business taxonomies with C++ classes (OMG), keeping all the data in RAM (OMG) and not

Re: Variables alignment

2016-08-28 Thread Araq
Use the `codegenDecl` pragma and to generate any kind of gcc/clang annotation you need. Compilers are usually good at alignment though.

Re: GTK 3.20 Nim wrapper

2016-08-28 Thread Stefan_Salewski
Thanks for reporting. I guess you are refering to the chess game? Lets look at line 70: if p0 != p1: window(widget.toplevel).title= "invalid move, ignored." As the compiler told us, there is a symbol window defined in module gtk3 as well as gdk3. So only two possibilities to try.

Re: GTK 3.20 Nim wrapper

2016-08-28 Thread Simon
I get an error when trying to compile board.nim(70, 26) Error: ambiguous call; both gtk3.window(obj: expr) and gdk3.window(object: expr) match for: (Widget) How to fix it?

Re: Send data structures between threads?

2016-08-28 Thread jyelon
I used the word "database" in the generic sense. Basically, go to any good shopping website (eg, wayfair, or amazon, or google shopping, for example), and see what that website "knows" about coffee tables. If you take a little time and study the website, I think you'll realize that it's a