Re: cannot countProcessor in compile time

2018-05-23 Thread dataman
The best way for this feature is to add a new code to the VM. No chances.

Re: cannot countProcessor in compile time

2018-05-22 Thread Varriount
Woops, yes, I meant to say alloca.

Re: cannot countProcessor in compile time

2018-05-21 Thread twetzel59
@Varriount, why is _calloc_ not portable? It just allocates zeroed memory. By any chance did you mean to say _alloca_ , the non-standard routine that allocates memory on the stack?

Re: cannot countProcessor in compile time

2018-05-21 Thread Stefan_Salewski
> If you really need to know the number of processors on a system, you could > always compile a sub-program during compile-time and invoke it. Indeed I assumed that. But I have no idea how to do it in detail in a user friendly way -- so that user can still do a plain "nimble install myTool".

Re: cannot countProcessor in compile time

2018-05-21 Thread Varriount
If you _really_ need to know the number of processors on a system, you could always compile a sub-program during compile-time and invoke it. Regarding allocating arrays at runtime, is there a reason that a [sequence](https://nim-lang.org/docs/manual.html#types-array-and-sequence-types) won't

Re: cannot countProcessor in compile time

2018-05-21 Thread Hlaaftana
There is UncheckedArray[T]

Re: cannot countProcessor in compile time

2018-05-21 Thread mashingan
@Vantage Yeah, I just realized now that you mentioned it. @Stefan Yes, in my case, it is exactly like that. Have staging server which similar with production server. * * * Let me change question a bit, is there any example to make array during runtime?

Re: cannot countProcessor in compile time

2018-05-20 Thread Vantage
Even if this worked it would only have the processors of the computer compiling. not the computer running your program.

cannot countProcessor in compile time

2018-05-20 Thread mashingan
This code failed with error message `Cannot 'importc' at compile time` import cpuinfo var arr: array[countProcessors(), int] Is there a way to get the processors count that will be used for creating an array?