BinaryByter
Stefan
Although logic and set theory is related to programming and therefore C/C++
Stefan
I was think about writing a new language 😞
BinaryByter
meh
BinaryByter
its boring
BinaryByter
atleast after a while
BinaryByter
just use YACC
BinaryByter
though YACC is a bit dumb
Thespartann
I created c+++
Thespartann
BinaryByter
stop dooting
Thespartann
lol
Thespartann
#ot
Stefan
I’ll be using ANTLR btw
olli
just use YACC
Why ? All C++ compilers have non-generated parsers/lexers
BinaryByter
but writing parsers and lexers is boring
Stefan
So has ruby
olli
gcc used to use bison
yes, used to...
Stefan
yes, used to...
Actually its a dumb move
Stefan
This implies they switched to LL which has a lesser recognising power
olli
This implies they switched to LL which has a lesser recognising power
I think it does make sense to overcome the limitations that Bison introduced
Stefan
Yes, it is used to overcome ambiguity grammar
Stefan
Because recursive descending parser is realllllly flexible
Stefan
This implies they switched to LL which has a lesser recognising power
Well, it actually doesn’t matter since C is (almost) CFG so that it is trivially LL
klimi
how are classes different than struct?
Stefan
how are classes different than struct?
Structs are just legacies from C
Stefan
There are no classes in C
klimi
so better to use classes?
klimi
even for small thing?
Mihail
how are classes different than struct?
in structs by default members are public
Mihail
on classes they're private
Mihail
that's it afaik
klimi
oh okay
klimi
and
Mat
and
Nothing else
klimi
is it bad to alocate array and use only half of it?
Mihail
well yeah
klimi
what i can use then
klimi
std vector?
Mat
so better to use classes?
You'll use structs if you're just holding stuff together and classes in other case
klimi
if i have 255 values... and i use cca 60 but i may use 100 or 200 or sth
Mat
is it bad to alocate array and use only half of it?
If you know you'll use half of it, why not create one half the size?
klimi
but not in average
klimi
i dont know
klimi
depends on user
klimi
or generator
Mihail
std vector?
then this will be the best way i think
klimi
will it be fastest?
Mihail
no idea tbh
klimi
like
klimi
i will have
klimi
hm
Mat
Nothing is faster than statically allocated space
klimi
i think im gonna sacrifise for speed
klimi
because
klimi
its
Mihail
Nope
aren't they just arrays too under the hood?
klimi
one char (0-255)
Mat
If you need space optimization, use std::vector
klimi
and i need 3d array
Mat
If you need speed, use arrays
klimi
to 16*16*256*(1byte)
Mihail
If you need space optimization, use std::vector
btw why reccomend vector for space, when "vector containers may allocate some extra storage to accommodate for possible growth, and thus the container may have an actual capacity greater than the storage strictly needed to contain its elements"?
klimi
to 16*16*256*(1byte)
full render distance will be 4 mb
klimi
8*8 * 16*16*256b
Mihail
Because if you can go from 5 to 60 elements, you'll have a 100 elements static array or a variable lenght array (vector) that will arrive near 100 only when needed
yes but when you expand that vector to for example 65, won't it allocate like 70 to accomodate for future growth?
Mihail
which won't be exactly space efficient
Mihail
or i don't understand it correctly?
olli
But i really think this depends on the use case and the implementation. Let's assume a vector allocates space for 16 elements and doubles every time it runs out of space.. to store 65 elements you have wasted space for 63 elements and had to do 4 allocations! (and maybe needed to copy 112 elements to move the elements to the new space!) This is neither space efficient nor is it really fast
Mat
I think about a situation where you don't know how much you'll need vs a situation where you know more or less how much you need
Mihail
yeah but imo the situations where you really can't decide how big of an array you'll need are kinda rare