BinaryByter
This admin guy who figured it out is just too smart
BinaryByter
lets kill him
aj
Pavel
Well, let me try to explain in more details
In the code that I pasted I wanted to resize the vector if the new index doesn't fit it.
Basically, I want to check the size and if it smaller, call resize.
But, I will probably need to resize it further in the future, so there are two options:
1) resize allocates memory for a vector of given to resize size (capacity = size). then any next push_back or resize to a bigger size will call another rellocation
2) resize will allocate more memory than the given size (capacity > size). something like capacity = size * 2.
So my question basically is: is the first case true or the second is true?
If first than I need to manage it myself how I did in my code example. Otherwise every resize will trigger reallocation.
BinaryByter
BinaryByter
resize does exactly the same thing ;)
BinaryByter
Pavel
yes, but it does it only when needed and all at once
BinaryByter
there is no definition of how much anything allocates
BinaryByter
BinaryByter
why would you ... push them into a vector?
Pavel
why would you ... push them into a vector?
it's an exaggurated case, but it is still possible in theory
I want the vector to be consistent with others (it's kind of Structure of Arrays thing that I'm working on)
BinaryByter
Well yea, when doing many pushbacks, you can and should resize first
Mat
If you know your upper and lower size bounds and they don't really differ from each other, you can allocate the vector using the upper bound value to save time
14•08
😂😂😂😂 lol
Anonymous
http://yosefk.com/c++fqa/defective.html
14•08
K bye
😂😂😂😂 i laugh again ..
Anonymous
Nothing, I Just was reading
Mihail
All arguments are literally named by the convention:
Defective + *literally every cpp feature*
And all the arguments themselves are either non-sense or they resolve around duplication of C code (false no matter from where you look at it) or marketing (yeah, really... 😂)
BinaryByter
Mihail
Also someone seems to be so keen on hating cpp (y tho?) that he even has a special way to send him articles related to the quirks of cpp that you don't personally like
BinaryByter
In naturally written C++ code, changing the private members of a class requires recompilation of the code using the class. When the class is used to instantiate member objects of other classes, the rule is of course applied recursively.
This makes C++ interfaces very unstable - a change invisible at the interface level still requires to rebuild the calling code, which can be very problematic when that code is not controlled by whoever makes the change. So shipping C++ interfaces to customers can be a bad idea.
BinaryByter
wtf?
BinaryByter
"changing code requires compilation.. buwhuuuhuuuuuhuhuuhuuu 😢😢😢😢"
Mihail
"you can't printf to an iostream" ummmm literally what
BinaryByter
BinaryByter
BWHOOHOOOHOOO :(:(:( WHY ISNT OLD STUFF COMPATIBLE TO NEWER BETTER STUFF :(:(:(
Mihail
Mihail
You printf to stdout
Mihail
Like
Mihail
What is he even saying
BinaryByter
he wants to be able to specify an ostream to the printf function probably
BinaryByter
except printf is already a thing
BinaryByter
and it was already a thing
BinaryByter
before ostreams were a thing
Mihail
BinaryByter
idk
Mihail
Me neither
BinaryByter
Mihail
I think I've had enough Internet for today tbh
Mihail
Gn
14•08
Johnny
Johnny
Can anyone tell me what's wrong?
Johnny
I'm trying to do a bubble sort order
BinaryByter
google the syntax for for
BinaryByter
basically, inCpp, you separate the "arguments" with a ;
Johnny
with a?
Johnny
oh ok
Johnny
oh sorry
Johnny
now that I realized my mistake, what a shame.
Johnny
😅
Anonymous
o/
Anonymous
helli
Anonymous
hello*
Anonymous
Can I ask about hanging of laptop
Liam
hello*
Error: hello doesn't name a type.
Parra
Parra
I do the same with metacall because of that (the plugin system has C interface)
Parra
you avoid nightmares like in v8 with this methodology
Alay
Okay I'll ask the most irritating question
What's the best source to learn c++ ?😂
olli
that's why people distributes software with C API sometimes
I doubt this is the reason why C APIs are shipped. This problem applies to C as well if you make a previously "exported"/availabe function static.
C makes it really easy to call functions from different languages since no name mangling is needed.
Parra
Parra
Parra
it doesn't happen in c if you modify a static method
Parra
or at least that what I understood
Parra
what I mean is that he talk about recompiling if you change a private method
Parra
recompiling the calling application or lib
Parra
if you change a static function only visible in a .c in C language do you have to recompile the calling application?
Parra
I don't think so
Parra
you never have to recompile calling lib/app if you dont touch the API in C