Dima
or your code is mistyped lol
Noble Friend
or your code is mistyped lol
corrected the message. 😶
Vlad
corrected the message. 😶
You're checking uninitialized data in while
Dima
try 'do while { }' instead also
Dima
Vlad
try 'do while { }' instead also
Also you got syntax wrong :P
Dima
yeah it was as example
Dima
didn’t use it for a while
Dima
lol that sounds
Vlad
yeah it was as example
That he will copy without thinking
Noble Friend
Youre reading uninitialized variable
oops, how do i initialize characters that should have been gotten from a key press?
Artöm
'\0' sufffice
MᏫᎻᎯᎷᎷᎬᎠ
Is it considered a good practice to inline every global variable?
su
In which office? Moscow? USA? Israel?
no, im not working at Intel Co
Noble Friend
'\0' sufffice
ok thanks. didn't work😶
Artöm
What did you enter?
Noble Friend
https://github.com/Mbanginu/move-cursor-in-c/blob/master/mc.c
Noble Friend
That's the full code. I simply sent the other short one to get what's wrong in the program
Alex
我是 艾文 is getch() a nonblocking function (means it won't stop there waiting for a key stike)?
Artöm
It blocks
Alex
Then either find a nonblocking function or setup the library to make getch() nonblocking. I remembered ncurses lib has that capability.
Alex
https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/
Noble Friend
ok man
Noble Friend
👌
Alex
https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html
Alex
More details on keyboard input functions
Ajay
Can anyone help me decode the meaning of chrono::steady_clock::now().time_since_epoch().count(); What I read that is steady_clock acts like a stop watch and does not tell the current time time_since_epoch means that the no. of seconds that have passed since 1jan, 1970(count() simply returns the no. of seconds) But, I don't get its meaning when combined.
Ajay
std::chrono::steady_clock::now() returns a std::chrono::time_point<std::chrono::steady_clock> https://en.cppreference.com/w/cpp/chrono/time_point
yeah, I understand that but don't get the meaning of the line in totality. I mean what does time_since_epoch().count() mean in addition to this?
Anonymous
yeah, I understand that but don't get the meaning of the line in totality. I mean what does time_since_epoch().count() mean in addition to this?
std::chrono::steady_clock is a clock. clocks have an epoch (which is probably not the UNIX epoch, as you have assumed) and a tick rate. std::chrono::time_point<std::chrono::steady_clock> stores a particular moment of the clock. time_since_epoch() produces the duration between the captured state (time_point) and the epoch of steady_clock. count() casts the duration to number of ticks of the steady_clock.
Anonymous
Will competetive proggramming help me get a job fast...???
Cengizhan
Hex?
What do you mean by that?
Nils
What do you mean by that?
Hex is 0-9 and a-f only
Cengizhan
Hex is 0-9 and a-f only
Was it sarcastic?
Vlad
Bad joke
Nils
Just a suggestion
Cengizhan
No? 🤔
Cmon, do not give any variable name like alphabet.
Cengizhan
We are humans, not computers.
Nils
Cmon, do not give any variable name like alphabet.
Ohhh, I didn't really read the context
Nils
Sorry
Cengizhan
Hex?
It was sarcastic ofc.
Pavel
How to better achieve this behavior: I need to add element to unordered_map if it's not there But if it is already there I need to perform some specific logic with the value in the map (possibly remove it from the map, to change the key). I wan't to make as less searches as possible. I tried to use emplace and use the returned iterator and bool, but it turned out that if the element was there and no insertion happened, then the iterator doesn't point to the element in the container (at least I can't delete the element with the iterator).
Pavel
Can I search for the element in unordered_map but if it's not found have an iterator that I can use as a hint for the insertion instead of end iterator?
Anonymous
Anonymous
Anonymous
can I get some help?
Pavel
can I get some help?
What kind of help are you searching for?
Anonymous
.
weird
weird
Sry
weird
Mistenk
Artöm
In C++17 theres try_emplace
Pavel
In C++17 theres try_emplace
👍 wonder why they didn't just change behaviour of emplace regarding this is it not to break existing code that depends on the fact that the rvalue object passed to emplace always getting moved 🤔
Daniele
guys is there a reason why vscode with gcc on linux (ubuntu) would not show the line where a segmentation fault happened? I'm using gdb as debugger, the program execution halts when it reaces the line that causes the seg fault, but it doesn't highlight it. The call stack says paused on exception, I kinda know why there is that issue: I had linked lists, but the list was not initialized to NULL at first, at a certain point I was trying to use a printf with a string and obviously broke when it reached the garbage data, halting the program. If I run the executable directly I get in the terminal "Segmentation Fault", but vscode halts without the usual notice. There is no reason why it should hide the highlight and banner since anything else like another type of segmentation fault (trying to read a non allocated memory, dividing by zero, ect..) all give out the right banner/highlight
Daniele
sorry for the wall of text
Artöm
Meyers once explained that, you may search on yt if interested
Pavel
Meyers once explained that, you may search on yt if interested
yep, will do, never heard about such requirements
Pavel
thanks for the hints
Asdew
sorry for the wall of text
It's much better than sending bunch of short messages or asking with too little information.
Daniele
I can debug just fine