BinaryByter
Undefined behaviour ig
Yea. Where is the problem with that?
BinaryByter
Still: where is the problem with UB?
Max
Still: where is the problem with UB?
did you read my post at all?
Anonymous
nobody forces you to use the stl
never claimed they did. Just means it's really hard to work with people who turn to the STL for everything
Max
Yes I did
so what's was the original claim about UB there?
BinaryByter
you SHOULD do use it
BinaryByter
so what's was the original claim about UB there?
that C has a bit of it and C++ has tons of it
BinaryByter
you imply that C++ is bad because of that
Anonymous
I don't like the amount of abstraction that the STL introduces though
Max
you SHOULD do use it
dude... there are hundreds of cases where it is not applicable
BinaryByter
Urgh not this debate again
Max
that C has a bit of it and C++ has tons of it
right. got the point? it is harder "get work done" in a field where CS is just a part of the story AND force people to learn about "static initialization fiasco" when dealing with C++ . they use C. it is easier.
Max
when you writing in C++ - you need to know C++ very well. when you writing in C - you need to spend lot less time learning it and invest more time about digging how the accel is working (for example).
Max
and yeah, not giving a fuck about ABI and not knowing what UB is in your position of ""LEAD DEVELOPER"" is kinda scary
Anonymous
I much prefer problems to be my fault and not the language's. The more that's under my control, the more that I can fix without relying on other people
Anonymous
Like, I'm not going to ask people to use a patched version of a library so it works with my program *cough* telegram *cough*
Anonymous
How is UB not a real problem?
BinaryByter
How IS it a problem?
Anonymous
Oh god, I'd love to break your software if you develop with that attitude
Max
its not scary because they are NOT real problems
now tell me about accessing nullptr
Max
yes?
are you using cin ?
BinaryByter
not in clinl
Anonymous
What happens if I point an element of an array to an arbitrary point in memory?
BinaryByter
Anonymous
Which will be?
BinaryByter
Which will be?
the content of the memory location
Anonymous
You don't know because that behaviour is undefined
BinaryByter
uffff
learn about osdev before "uffffing" randomly
Anonymous
it may break your program or it may return garbage. you don't knpw
Anonymous
*know
Max
learn about osdev before "uffffing" randomly
my little friend, I'm an OS developer actually.
BinaryByter
You don't know because that behaviour is undefined
so EVERYTIME I access a variable its an undefined behaviour
Anonymous
No, accessing random memory locations is undefined behavour. It's defined if it is within the bounds of your program.
BinaryByter
Dudes, i'm sick of your religious love towards C so let's call it a day
Max
so, I will help you a bit. a) accessing memory trough pointer which doesn't point to any valid object is UB. go learn C++ standart, kid. b) go check 'secure coding in C++' book.
Anonymous
I take it you don't do defensive development
Anonymous
Please for the love of $deity ask someone like Mike Larkin or Phillip Guenther what the problem with your way of thinking is
Max
calling me a kid in a debate is kind of a thing you try to avoid when debating
debating about C++ and saying "UB is not a problem" is the same thing
Anonymous
Or alternatively Colin Percival
Anonymous
who is a genius
BinaryByter
SO what does C have as a solution for UB?
BinaryByter
remember that C is almost fully compatible to C++
Max
SO what does C have as a solution for UB?
it has no solutions. the list of UBs in C is far less smaller.
BinaryByter
BinaryByter
Trust me: ub is not a problem
BinaryByter
anyway, piano lessons
Max
Trust me: ub is not a problem
after what you've said, I will never trust you nor your products
Max
Trust me: ub is not a problem
it is - you must know it. hardware enginerrs don't give a damn, why a vector can't reallocate memory when you accessing it past its boundaries.
Max
they need to write a driver. right here, right now. to make it in C++ you need lot more knowledge. about OOP in particular. about templates.
Max
and about tons of other stuff, like: - why can't put template class/function into the source file - why linking error when trying to call C function from other library - why 10 pages of duck typing error when passing invalid parameter into the template argument - why can't memset(this) - why UB when destructor is not virtual? - why code is bloated? - why tons of linkage errors when enabling exceptions? - how to force static initialization order? and more, more, more
Max
and killer nail - C++ exceptions and standart libraries are not realtime.
Dima
lol some things you need to know even if you are not hardware engineer lol
Dima
double lol
Max
I mean that if you are dealing with C++, you forced to solve C++ - related issues, every time. When you writing in C - well, you have plain and simple language, so you can go and do other stuff, that more important than programming
klimi
Oh...
Max
you don't need to spend hours of reading "Effective C++", then "Effective modern C++", after "More Effective C++", then "C++ Concurrency In Action"... and the list is going on and on
klimi
You don't?
Dima
well I agree
Dima
anyone uses c++ exceptions?hahahah
Max
switched to other books. more technology-related. "Secure coding", "Analog interfacing to MCU", "ARM definitive guide".
olli
Still, if you know how to use the STL you are likely to have as efficient code in C++. Furthermore you have less effort and rely on a well tested libraries. The combination of less code and a tested library is likely to yield more reliable and secure software
Max
Still, if you know how to use the STL you are likely to have as efficient code in C++. Furthermore you have less effort and rely on a well tested libraries. The combination of less code and a tested library is likely to yield more reliable and secure software
in many areas, as I said, you can't use STL. in many cases, you have no time learning STL. you can't even do a new or malloc. it is not about efficiency. it is about time you need to workaround limitations or learn things in order to do one, fairly simple, task
Max
I don't argue that C++ is a great language
Max
I do argue that C is a great language and it is used because of C++ is not applicable everywhere
olli
There are many parts of the STL that do not rely on dynamic memory allocation. And container offer a template parameter for your custom allocator
Anonymous
I'm not arguing that I can write a better version of vector for instance, just that I know the techniques for dynamically allocating arrays in C and thus if my dynamically created array breaks, I can fix it
olli
What can C do that C++ can't?
Max
There are many parts of the STL that do not rely on dynamic memory allocation. And container offer a template parameter for your custom allocator
allocator must trow an exception if allocation fails. in areas I've described you usualy can't trow an exception. returning nullptr is UB.