BinaryByter
BinaryByter
Still: where is the problem with UB?
Max
BinaryByter
Max
Yes I did
so what's was the original claim about UB there?
BinaryByter
BinaryByter
you SHOULD do use it
BinaryByter
BinaryByter
you imply that C++ is bad because of that
Anonymous
I don't like the amount of abstraction that the STL introduces though
Anonymous
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.
BinaryByter
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
Max
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*
BinaryByter
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
BinaryByter
Max
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?
Max
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
BinaryByter
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
BinaryByter
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
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++
BinaryByter
BinaryByter
Trust me: ub is not a problem
BinaryByter
anyway, piano lessons
BinaryByter
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
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