olli
Yes, what is not known is which objects will add themselves to the list, as that is specific to the object in question
What determines whether a object adds itself? If the objects are known at compile time, most likely you will know at compile time whether it will add itself, won't you?
Diego
What determines whether a object adds itself? If the objects are known at compile time, most likely you will know at compile time whether it will add itself, won't you?
Yes, I will, but manually specifying which objects are going to add separately from the objects themselves feels cumbersome But as I said this may be just a bias, if you say I should do that then I'll trust your experience
olli
Yes, I will, but manually specifying which objects are going to add separately from the objects themselves feels cumbersome But as I said this may be just a bias, if you say I should do that then I'll trust your experience
Yes, I agree that it is bothersome. I feel like I'm still missing some context. Some code would definitely help. I still don't get why you need a list since you mentioned you'll free the list afterwards. Can't you just call the functions in a loop on every object? Object_t *object; for_each(&object, ... ) {| if (register_object(object)) // object would add itself to the list, // so we need to start it start_object(object); } I could also imagine you to have some code generation tool that does what you need at compile time. (That's what we've been using on some super critical embedded projects because we needed to verify the whole thing statically)
Anonymous
I've read several resources that it's possible to debug it, and my logging tool (which I made myself) also measures the distance between the heap and the stack each time a log message is made All messages are on a single fixed size array allocated ay startup and I simply flush them after a while or before it fills, and set the index back to 0 to begin overwriting everything anew
A logging message buffer? WARNING! ROUGH DRAFT!! #define SZ 4096 #define MAXLINE 120 char buffer[SZ+MAXLINE]; int LEN = 0; int seekEOL(char *str) { char *tmp = strchr(str, '\n'); if(!tmp) return 0; else return (tmp-str); } void logMSG(char *msg) { buf = buffer + LEN; sprintf(buf, "%.*s\n", MAXLINE-1, msg); int len = strlen(buf); LEN += len; if(LEN >= SZ) { int start = seekEOL(buffer) + 1; memmove(buffer, &buffer[start], start); LEN -= start; buffer[LEN] = '\0'; } }
Diego
I'm still very new to the world of C++ programming, so I appreciate the patience you've had!
Diego
Well, other than the compiler itself but that's probably not what you mean What kind of tools and respective use cases do you consider would be helpful in such a project? If you'd like to tell me
Diego
/get ide
Dennis
🥰🥰☺😛
Dominator
Azure and AWS Certification Group @awsexamdumps
yunal
I want 32bit compiler
yunal
can anybody help me
yunal
/get cppbookguide
Anonymous
Morning
J
Morning
J
🌅
Anonymous
My image????
J
Yes😃
Anonymous
Yes😃
Please i can not send it
J
🌅🌅🌅
Anonymous
I don't have good picture
Lim
@jeffreytse Are you a c programmer or c++ programmer?
J
Both
J
Any issues?
Anonymous
C++ am not a good am here for learning
Lim
Any issues?
So, how do you search keyword with VIM?
J
Global search you mean?
Lim
grep ?
Lim
Maybe I should ask this question in VIM group😂
J
Generally, if you search the keyword in the same file, you just use the / or ? or *. But if you search keyword globally, you can try fzf or rg or ...
AmR
Why std::thread is so hard ?!
AmR
what is hard?
I can't get how to use it.
Alex
find sample and modify it up to your needs
AmR
I try find any example work with gui but I can't find it.
AmR
I try get checksum for long files list. I want use std::thread to make app not freezing.
我是大娃
[ test_checktime]$ ./test 2021-01-25T16:35:52+08:00 Running ./test Run on (6 X 3700 MHz CPU s) CPU Caches: L1 Data 32 KiB (x6) L1 Instruction 32 KiB (x6) L2 Unified 256 KiB (x6) L3 Unified 9216 KiB (x1) Load Average: 0.00, 0.00, 0.00 -------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------- BM_CHECKENTRUSTTIME 181712 ns 181561 ns 3861 [ test_checktime]$ ./test 2021-01-25T16:35:58+08:00 Running ./test Run on (6 X 3700 MHz CPU s) CPU Caches: L1 Data 32 KiB (x6) L1 Instruction 32 KiB (x6) L2 Unified 256 KiB (x6) L3 Unified 9216 KiB (x1) Load Average: 0.07, 0.02, 0.00 -------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------- BM_CHECKENTRUSTTIME 988 ns 987 ns 706799s
Alex
why same code has different result?
different input. probably you wait for some input data in first case. that`s why load average is 0.0
AmR
why same code has different result?
when I Don't use thread the exec time for func is 35s. When I use std::async it's 11s
AmR
It's files in local path for test
我是大娃
I find this function ‘mktime'
我是大娃
after I remove it
我是大娃
2021-01-25T18:07:53+08:00 Running ./test Run on (6 X 3700 MHz CPU s) CPU Caches: L1 Data 32 KiB (x6) L1 Instruction 32 KiB (x6) L2 Unified 256 KiB (x6) L3 Unified 9216 KiB (x1) Load Average: 0.01, 0.06, 0.03 -------------------------------------------------------------- Benchmark Time CPU Iterations -------------------------------------------------------------- BM_CHECKENTRUSTTIME 703 ns 702 ns 990583
我是大娃
benchmark test is stable
ㅤㅤㅤ
#include <iostream> #include <string.h> using namespace std; int main() { int n; cin>>n; int x=0; char bit[4]; for(int i=0;i<n;i++){ scanf("%s",&bit); if(strcmp(bit,"++x" == 0) || strcmp(bit,"x++" == 0) || strcmp(bit,"X++" == 0) || strcmp(bit,"++X" == 0)){ x+=1; } else if(strcmp(bit,"--x" == 0) || strcmp(bit,"x--" == 0) || strcmp(bit,"X--" == 0) | strcmp(bit,"--X" == 0)){ x-=1; } x=x; } cout<<x; return 0; } this works on devc++ but gives error on codeforces. Problem 282A
ㅤㅤㅤ
You are using string.h which is C library, and iostream, which is C++ library?
but c++ supports all of c so that should not be a problem maybe
Alex
but c++ supports all of c so that should not be a problem maybe
this is not problem, but better to use cstring. this code is weird: for(int i=0;i<n;i++){ scanf("%s",&bit);
Anonymous
but c++ supports all of c so that should not be a problem maybe
> but c++ supports all of c It's not true
Anonymous
Well most of it. The only thing i can think of are unsafe operations that got obsolete
Anonymous
Like assingning pointer types without casting
Alex
Well most of it. The only thing i can think of are unsafe operations that got obsolete
type of char literal; declaration obligatory; recursive main func, zero-width array; auto, class,.. keyword; empty argument list in declaration etc
Rama k
Hey
falcon
Hey 👋
falcon
Can anyone guide me for competitive programming
James©®
can anybody help me with installing vcpkg in vscode
Anonymous
Vcpkg and VSCode are separate things
James©®
i want to install c libraries in vs code
Anonymous
VSCode is just a text editor
James©®
have u used vs code earlier
Anonymous
Do you install C libraries in default Notepad? No Same with VS Code
James©®
Do you install C libraries in default Notepad? No Same with VS Code
no those are different things u can search on google
Diego
no those are different things u can search on google
What he means is that VSCode is very lightweight compared to other, more robust, more fitting IDEs
Diego
And that it doesn't do any package management on its own
Diego
https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=msvc-160
Anonymous
no those are different things u can search on google
Dude, if you don't know what you're talking, it's better to stay quiet
Diego
You can try this, though; but it's a CLI Maybe there's a plugin for VSCode that integrates vcpkg?
Marián
bruh vcpkg be like 182901828gb per package
Marián
gb?
meme ref to the size of vcpkg
Marián
it downloads and builds pkgs from source so it's huge
Marián
gtkmm is like 10gbs total lol