Anonymous
Although that's a bad example. I prefer to use linked lists to arrays
olli
Anonymous
Generally in my programs, I prefer to create a struct to hold the data (whatever it might be) and build that as a linked list.
Anonymous
as in the way addrinfo does it
Anonymous
From a hobby perspective, let's also consider language minimalism
olli
Anonymous
You do, but if it means I don't have to start linking to a substantially larger standard library then I'm happy to debug those problems
Max
Dima
mmm data oriented design
Anonymous
I'm all about software minimalism, which means I dislike having bigger binaries for the sake of making the development work 10% easier
Dima
I agree
olli
Anonymous
From a hobbyist perspective, using C over C++ also helps you to learn C++ more thoroughly by exposing you to things you wouldn't worry about in C++
Max
Anonymous
It's not comparable to the extra weight of linking to the C++ stdlib
Dima
I hate stdlib
Dima
sort is ok but the rest
Anonymous
hi
Anonymous
I'm in no way trying to claim I can write a better stdlib than anyone else but it adds a substantial amount of weight to the binary if you are statically linking it
Dima
backer lol
Anonymous
He clearly meant baker xD
Dima
Max
hi
hi, are your croissants fresh today?
Max
I'll buy a few.
Max
Anonymous
Yeah, I totally understand your point but when I develop for myself, I try to avoid what I call "black magic" so I try to do things where I am implementing as much as is sensible myself.
olli
Max
olli
For what exactly?
Anonymous
I know arrays are really just pointers to areas of pre-allocated memory but it's the principle that matters to me.
olli
You're pointer to next is the same
Anonymous
If I can, in principle, design my own array-like data structure then I start to understand the language better
olli
And you are completely fine with that :) I just don't agree with "linked lists are preferred"
Anonymous
I suppose it depends if you needthe content to be dynamic or not
Anonymous
For example, implementing a stack
olli
Can be done using an array, increase index = push, decrease index = pop
No cycles wasted allocating memory
Anonymous
Why my programs stops smtimes..(beginneeer)..!?
olli
Linked lists are awesome if you need to insert in the middle or the beginning
Anonymous
In if else statements
olli
Arrays can't beat their performance there
olli
E.g. queues are the ideal use case for linked lists
Max
For what exactly?
dynamic registering of some modules/handlers, where data object allocation is managed inside a module
cases where length of object collection is not known
cases where an cache penalty is less than copying data when re-allocating the array.
cases where you need O(1) insertion (realtime, for example)
Max
g2g :)
olli
olli
Probably depends on your project, but in our environment we need to be Asil conform. Using any dynamic memory is not permitted
Anonymous
In a realtime system there's little chance your experience will allow you to create a faster insertion mechanism than a stdlib developer
Anonymous
Although my projects don't normally have to conform to standards xD
BinaryByter
Anonymous
The only times I write code that conforms to any standards I tend to use OpenBSD's style(9)
Anonymous
@anunaym14 spam
Anonymous
Anonymous
also, I would have thought a channel full of nerds is the last place that would be interested in football
Anonymous
Anonymous
Has anyone had any experience with BLE in C?
𝐧𝐄
you can advertise
Anonymous
Anonymous
no-one wants that
𝐧𝐄
😑
Anonymous
I've just got a BLE outdoor gate lock for farm fields and I've found a vuln in it and I want to write the PoC exploit now
𝐧𝐄
Off
BinaryByter
BinaryByter
#teamCLINL for C++
Anonymous
I've never understood the hate for the pointer
BinaryByter
they are not safe
BinaryByter
references will NEVER be empty
BinaryByter
pointers... they may point to unallocated space or even worse, to space that is owned by another object
BinaryByter
though former problem never applies in OsDev
BinaryByter
atleast not before memory-management was done
Anonymous
Does C++ still use sys/socket.h et al for networking stuff?
Ибраги́м
What can C do that C++ can't?
1. C can make code unreadable faster. Try coding compile-time factorial with C. Macros?
2. C makes code duplication easy with lack of templates equivalent.
3. With lack of overloading, C becomes a ugly pile of func_int(), func_float ()..
If u do the above in C++, u deserve to be executed publicly on r/programming
BinaryByter
BinaryByter
You use third party libraries for networking
BinaryByter
C++20 will change that though hopefully
Anonymous
I read that as unnecessary liabilities