Anonymous
it will make me a stronger developer i believe in the long run , even if i am using higher level languages in a profession setting
Anonymous
it will - trust me
one last question , in that else statement , how can i ask the question again or go back to the point in the code where the question was asked, i tried goto but it is shit
Anonymous
Such an ugly code
hey i said it works , didnt say it was pretty lol
Anonymous
Your code style is a mess, tbh
i just started not to long again , give me a break
Anonymous
Use camelCase, PascalCase or snake_case Not this.. Please
Mar!o
And why are you using void pointers instead of chars strncmp is only working with chars!
Mar!o
And are you using C++ or C?
Mar!o
I see but maybe he is writing "C" style c++ 😂
Anonymous
You gotta see what qsort requires
Anonymous
Use camelCase, PascalCase or snake_case Not this.. Please
O I see , you are talking about my name conventions .lol yea I know it’s trash but I don’t care to change because I would have to change it every where in the project
Mar!o
Just as note I like to make arguments const whenever possible - so instad of auto func (dword32 x) -> voidI write auto func (const dword32 x) -> voidwith pointers: const ptr 2 mutable data auto func (void* const ptr) -> voidI know that there is no or no noticeable peformance difference but at least the const pointer to mutable or const memory safes n00bs to assign the pointer and wonder why their ptr is still null!
Anonymous
https://www.geeksforgeeks.org/comparator-function-of-qsort-in-c/ @reinterpret_cast see if you look here what syntax they use for comparator functions
Anonymous
The comparator function takes two pointers as arguments (both type-casted to const void*) and defines the order of the elements by returning (in a stable and transitive manner @reinterpret_cast
Mar!o
Okay and you want to sort the strings alphabetically
Mar!o
Then you could do...
Anonymous
yea its just a function i pass as a parameter in the qsort function
Anonymous
const void pointers are needed in this case
Anonymous
i tried it other ways and the compiler told me to get the hell out here with that
Mar!o
Then you could do...
My pc crashed gimme a sec 😂
Mar!o
wait... why do you write a custom compare functor shouldnt that work: qsort(array, array_len, sizeof *array, strcmp); ?
Mar!o
And I need the opinion of your folks: I´m currently working on my own "programming language" which is basically a language which my compiler then converts to c++, which then is compiled into an executable using clang. Is it still legit to call it a programming language - because it runs on C++?
Anonymous
nope, since the signatures are different
Mar!o
So I can call it a own language?
Anonymous
that answer was to you asking why you couldn't pass strcmp to qsort directly
Mar!o
I wondered 😂
Anonymous
but yeah, it still counts as a programming language, it doesn't matter what your compiler targets or that it doesn't compile to an executable directly
Mar!o
The qsort takes a function pointer as a parameter
I see I thought you can do this directly
Anonymous
I see I thought you can do this directly
It’s a lot like functional programming in JavaScript
Anonymous
With callback functions
Anonymous
It’s basically a callback function
...
Hi
Anonymous
Hello here
Anonymous
Can anyone please teach me C/C++?
klimi
Can anyone please teach me C/C++?
I dont think anyone would be willing to do that
Anonymous
Can anyone please teach me C/C++?
You know , there are a lot of resources online
Anonymous
Hami
K
klimi
Bullshit
Anonymous
Anonymous
Why is that
I'm neither a compiler developer nor a C++ guru, so I don't know
Anonymous
I just repeat what other C++ gurus say
Pavel
I just repeat what other C++ gurus say
Maybe I was about const T& not about const T?
olli
Why is that
you can't move from const (as an example where const might be decreasing perf)
Pavel
Oh, that makes sense
klimi
Anonymous
Finally
Anonymous
Can i slide in your dm
Anonymous
I have done that
klimi
You dont even have to ask it seems if you know the answer before I read the question
Anonymous
What's that suppose to mean
Anonymous
For what ??
Ilya
$1000000
And prepaiment
Anonymous
Dont worry
Ilya
For what ??
For teaching you C++, it's not expensive, it is at least 4-5 years of my life
Anonymous
okay
Mar!o
const parameters can kill some performance optimizations
What optimizations? Note from stackoverflow: "const is pointless when the argument is passed by value since you will not be modifying the caller's object." Wrong. It's about self-documenting your code and your assumptions. If your code has many people working on it and your functions are non-trivial then you should mark "const" any and everything that you can. When writing industrial-strength code, you should always assume that your coworkers are psychopaths trying to get you any way they can (especially since it's often yourself in the future). Besides, as somebody mentioned earlier, it might help the compiler optimize things a bit (though it's a long shot).
Mar!o
I see but moving primitives like int or a pointer is nonsense
Mar!o
But it could make sence on something like a string or a vector but they are seldom passed by value
Anonymous
Definitely
Mar!o
:)
Gimmy
Can anyone suggest good resource to learn advance oops concept??
Anonymous
Hi everyone here