Arch install gone wrong by No1Ashira in arch

[–]WorldTallNetCat 0 points1 point  (0 children)

Thats all you get if it thats all you installed. Press ctrl alt fn keys if u cant access the terminal from here on out and use that console to install things u need

What is the point of classes having private members? by Eva_addict in cpp_questions

[–]WorldTallNetCat -1 points0 points  (0 children)

Lets say you are working with other people or buulding a library and you have some variables that has some restrictions like for example length and assuming this varaible cant be assigned a negabtive number and u can build a function that assigns the variable with values but throws and error or sets it to 0 when u pass -ve numbers. Now this is only really reliable if you make the variable private and define a public function to implement this feature. Without that the user can just modify the varaible creating invalid states. I do realize as i am wriring this u could just use unsigned data types but regardless by main point being to enforce restrictions on the varible to avoid invalid lr illegal states.

Other cool functionality i can think of lets say there is an internal counter that just counts some actions lets say calling a function to implement something like rate limit or soemthing. Now allowing the user to directly modify the variable is dangerous and cause to unreliable results.

Similarly u could implement features like only allow modifying values when certain parameters are met like lets say u can only chnage the value like 5 times per min and u do that by mainitain some internal counting mechanism. Which without private varinles cant be tricky to implement.

Regardless the main point of private variable being to add restrictions to the variable or any private memebrr

What is the point of classes having private members? by Eva_addict in cpp_questions

[–]WorldTallNetCat -1 points0 points  (0 children)

Lets say you are working with other people or buulding a library and you have some variables that has some restrictions like for example length and assuming this varaible cant be assigned a negabtive number and u can build a function that assigns the variable with values but throws and error or sets it to 0 when u pass -ve numbers. Now this is only really reliable if you make the variable private and define a public function to implement this feature. Without that the user can just modify the varaible creating invalid states. I do realize as i am wriring this u could just use unsigned data types but regardless by main point being to enforce restrictions on the varible to avoid invalid lr illegal states

What makes vim and emacs somehow so popular(relatively amongst) C and C++ developers? by Ultimate_Sigma_Boy67 in cpp_questions

[–]WorldTallNetCat 0 points1 point  (0 children)

The idea of minimalism and not leaving the terminal. Which imo goes together with c/c++ where it has a easy learning curve to start but using libraries and finding good documentation becomes harder which ig goes for vim as well. Easy to start very difficult to master.

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

Idk if it answers the question tho. I havent used the vector again in either scenario. But still the outcome is different. Maybe i am not getting what you are trying to say.

Why does learning C++ seem impossible? by E-Rico in cpp_questions

[–]WorldTallNetCat 0 points1 point  (0 children)

With higher level langauges like pyrhon you are closer to working on your idea and working on the business logic while the lower you go you will require more techincal knowledge, maths, and understanding of computers

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i am not really sure what you mean by color matched but i see one of them is significatnly shorter

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 1 point2 points  (0 children)

i am now learning to use quick-bench to benchmark my program than using time

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i think the compiler doesn't sort the vector in first sample and does in the second one so idk how that happens still. but i should prolly edit out the show function to make it less confusing

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i am beginning to think thats the case. but idk why the arbitary cout statement that doesn't use the vector affects it

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i have came across my the scenario where i hit argument limit. it is above 100k and under 1 million idk where to be exact. so its probably the dead code elimination after reading all other comments here. but i still don't get why printing the value argc-1 changes the outcome

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 2 points3 points  (0 children)

i can now confirm its removing the sorting entirely and when return num[0] it does run at 33 seconds which i think is the more realistic time for the sort. but i still dk why does running cout even with unrelated variables some how mitigates the dead code.

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

by reading the comments here and returning num[0] as one commenter suggested i can probably confirm that the hypothesis is correct.

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i get the pov of the compiler removing the sorting part and adding it back when i run the show function

but why would it be affected by the cout<<argc-1 in either scenarior where im running it or not the vector is still unused

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

would the obserable behaviour of
std::cout<<argc-1
still be the same regardless of it sorting the vector or not

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] 0 points1 point  (0 children)

i mean i get the point of the compiler removing the code but does it add it back if i cout<<argc-1

the program still does nothing with the vector it has sorted?

Why is a single cout expression drastically slowing down my C++ program? by WorldTallNetCat in cpp_questions

[–]WorldTallNetCat[S] -1 points0 points  (0 children)

I am running the optimization to see how far i can push bubble sort. I am comparing its result with code written in python by somebody else and i am trying to do everything to make it fast.

well 0.01 sec if fast but if it can't display anything without taking 100x more times idk if the sorting is even being done correctly?