I noticed that **https://nim-lang.org/docs/lib.html** no longer lists
**oldwinapi**
My nimble copy of oldwinapi still seems to be working with nim version 0.17.0
Is that about to change?
If so, what is/will the new MS windows api module called?
Well, first draft, and partial nimble support.
[https://github.com/StefanSalewski/gintro](https://github.com/StefanSalewski/gintro)
If you have GTK3 installed you may try.
For 64 bit Linux and GTK 3.22 it should work. If "nimble prepare" commands
fails, let me know.
First goal is of course tha
If you'll add a type cast in inddexing, your snippet will work (either of them):
echo capital[ITALY.int]
And Byou can omit type in variable declaration altogether:
var capital = ["Rome", "Berlin", "Lisbon"]
But if the point is to just use explicit values for
Thanks for the help Araq.
The Nim enum behaves differently so I think this code reproduces better the Cpp
code behaviour.
const
ITALY = 0
GERMANY = 1
PORTUGAL = 2
var capital: array = ["Rome", "Berlin", "Lisbon"]
echo capital[PORTUGAL]
Sorry
I did not know this is possible. Seems very interesting.
No, arrays can use enums as the index type (and I use this feature all the
time):
type country = enum
ITALY,
GERMANY,
PORTUGAL
var capital: array[country, string] = ["Rome", "Berlin", "Lisbon"]
echo capital[ITALY]
Sorry for the noobish question. I want to understand how using the enums like
in C/C++
// Example program
#include
#include
using namespace std;
int main()
{
enum country {ITALY, GERMANY, PORTUGAL};
string capital[] = {"Rome", "Berlin", "Lis
RedFred, note that
proc test_arr(): seq[int] {.cdecl, exportc} =
...
return list
may work better, as a seq is already a pointer. You don't want a pointer to
that pointer. Of course the seq is more than a plain array internally, there is
at least the size member an
Just define `log(varargs[F])` before `log(Fer)`. From the error messages you
see in the body of `log(Fer)` only this one `log` is known, compiler is unaware
of the second.
var p_arr = alloc(size_of(array[int, 3]))
Above is incorrect syntax
Do
var p_arr = alloc sizeof(array[3, int])
Also [pointer arithmetic post](https://forum.nim-lang.org/t/1188#7366) should
be helpful
When you `alloc` something, it'll be put in heap, and untracked,
You can combine the initialization into a single call
import seqUtils
var rows = 2
var cols = 3
var s = newSeqWith(rows, newSeq[string](cols))
for row in 0..
Hi, I'm trying to dynamically create a seq[seq[string]]. Below is what I came
up with, and while it works, I'm wondering if it's the "right" way. At run
time, the dimension sizes are known, so is an array more appropriate/efficient?
Thanks for any insights you can provide.
var rows
Hi @mashingan, @Stefan_Salewski
I find it impossible to allocate memory for array, as when I try to do
something like:
var p_arr = alloc(size_of(array[int, 3]))
I get a 'type expected' error.
Besides, if array is created on the stack then passing a pointer to it is
meaningle
I am working on a structured logging library for Nim similar to
[ln](https://github.com/apg/ln). I am having an issue with passing concepts to
functions:
import streams, strutils, tables
type
F* = Table[string, string]
Fer* = concept x
x.f() is F
14 matches
Mail list logo