Pavel
A funny story happened to me this week. I'm not a fan of complex templates but decided to write a bitset class that can be parameterized with a enum (so I can use enum values as bit flags).
And to top of that, I wanted to add some handy functions for checking multiple values at once, using variadic templates.
So this is code I wrote (my thoughts were "oh, is it that simple?").
https://pastebin.com/HcDS7zmz
It compiled, run... but tests were failing for some reason...
I investigated a bit and found out that only the first values are considered in the function calls, and it seemed like I didn't actually use variadic templates. Seems like I used some kind of variadic functions (never used them before, so can't be sure).
Finally, I've rewritten it using real variadic templates. Become much more verbose, but at least it works correctly now (the bitset size is still not good, I'll replace it with magic_enum library call magic_enum::enum_count<T>() ).
https://pastebin.com/Dtxw0rTu
Funny thing that if I didn't write tests for it, I could leave this code as it was and added some hard to catch bugs to my project. And I decided to write the tests only because the code was actually crashing (as I understand because of stack overflow on the bitset allocation, because of too big size).
I found a way to significantly reduce code size (almost 3 times) and to improve readability of that code with C++17 fold expressions.
https://pastebin.com/5qdk042e
Vikram
Best IDE for c, c++, copy ?
Mat
@martinjke
Marat Gimadiev:
Hi everyone, I implemented stack using linked list in C. For compiling I use gcc.
On fedora my code works fine.
if I run on windows with gdb everything works fine too. But without -g flag malloc function causes segmentation fault.
Part of the code is posted here https://pastebin.com/FP3BvLvn. Segmentation fault appears after I use push function second time.
Anonymous
yes i am also does this earth has other than human
Anonymous
hi everyone
Anonymous
hows it going
Anonymous
hope all is well with you all
Anonymous
go it also my English is Al 😆 no it is so don't lol
Anonymous
wowwie
jot.rs
Anonymous
Anonymous
Dima
Lol there’s no Turbo C
Anonymous
klimi
Abo alazi
Is there a way to get out of Yemen or travel outside Yemen?
Matthias
/
Anonymous
Hello
klimi
Azzam
yue
vim is the beat ide in the universe.
yue
best
I_Interface
I_Interface
Francisco
It seems like many people don't know the difference between an IDE and an editor
I_Interface
NXiss7
NXiss7
NXiss7
Artöm
Chill, vim might suffice for his purposes. Wouldnt call it ide though
NXiss7
yue
what are you talking about?
yue
i just hear of that, if you want to start a war in a IT group ,you just say "xxx is the best langue/ide in the world"
yue
🤣
Anonymous
Vsuegdieve
Artöm
Daniele
anybody know anything about win32 api?
Artöm
Ms has good docs, go read them
Artöm
Or ask concrete question
Artöm
You can
Daniele
aight
Daniele
so the question is: I'm using visual studio to create the .rc file. to create a menu I used the gui and everything works, but I have no idea how to make an item of the menu checked or not
Daniele
the reference for this would be notepad's word wrap menu item, it's checked when word wrap is on and clean when it's off
Anonymous
My advice: use Qt for building interfaces
Surge.rs
Surge.rs
https://docs.microsoft.com/en-us/windows/win32/api/
Surge.rs
actually i lied i was talkin about win.h lol
Surge.rs
Surge.rs
i like that mentality
Daniele
I don't like Qt
Surge.rs
Daniele
maybe it's written in the documentation, I won't say it can't, but I haven't been able to find it so I asked if anybody knew
Đỗ
Đỗ
Daniele
András
Đỗ
set it directly though obect, for i.e. A.checked = true
If u using win 32 api, call it though appropriate function
...
wat, please tell me, which library do you install under a windows system to use the winapi?
András
Đỗ
Nothing, its has been pack in Operating System. But may be some api function has been depreacated, so u must be check and verify before using it
...
nope wrong, *most* winapi functions call into the ntdll which is shipped with every windows installation
MengShu
András
Daniele
Daniele
well of course you need the windows sdk for it, if you install vs2019 it's included, otherwise you need visual studio build tools
...
how can you not?
...
András
...
yes you can, take a look at the ss, all functions are exported
Daniele
heh why would you tho?