Guild icon
DDraceNetwork
DDraceNetwork / off-topic
Any languages allowed
Between 2023-08-18 00:00:00Z and 2023-08-19 00:00:00Z
Avatar
BBBBLLLLLLAAAAAAAAAADDDDDDDEEEEEEEEEEEE
Avatar
⬆️ sux ⬆️
Avatar
Avatar
Blade
Why does everyone call me bllaaaaddeee ingane kek
ur my best friend blade
Avatar
Avatar
Xin
⬆️ sux ⬆️
Lol the meme still lives @Scrumplex
Avatar
2b2t just died
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
Would it be as strong if the girl was ugly? As in one fatso calling another fat i think it wouldnt work personally
Avatar
Avatar
pilonpl
2b2t just died
WTF
Avatar
Hausemaster deleted some of the old chunks
05:52
And items
Avatar
Avatar
Ryozuki
just posti t on github somewhen
I did
09:11
I won't make it public tho
Avatar
Avatar
pilonpl
I won't make it public tho
why not
09:23
>~<
Avatar
Because it's work in progress
09:24
I mean
09:24
I can make it public
09:24
I suppose
Avatar
Just don't look at it
Avatar
Avatar
pilonpl
Because it's work in progress
you dont have to make it public only when its ready
Avatar
I guess
Avatar
https://github.com/MilkeeyCat/ddnet-web-demo-viewer i posted here 5 files which do nothing
Contribute to MilkeeyCat/ddnet-web-demo-viewer development by creating an account on GitHub.
09:24
lel
Avatar
Alright
09:25
I'll make it public
09:28
Contribute to pilonpl/minesweeper development by creating an account on GitHub.
09:28
I don't want you to look at it but heres the link
09:28
Lol
Avatar
Dont forget to use the right winning conditions
09:35
Placing all flags and not Clearing all tiles
09:35
(both is fine too)
09:53
u should declare Array2D on the stack and only malloc the data field
09:53
see, u dont understand pointers yet i think
09:53
or well, malloc
Avatar
literally me pepeW
Avatar
and u dont need a for loop to set everything to 0
09:54
use memset
Avatar
I know
Avatar
Avatar
Ryozuki
ur malloc is wrong
Well i guess
Avatar
no guess, its wrong xd
Avatar
I don't rember what i did
09:56
But i think i did a lot of weird stuff (edited)
Avatar
Avatar
Ryozuki
u should declare Array2D on the stack and only malloc the data field
I didn't know how to do that i guess
10:06
And I don't know what's wrong with this approach
10:06
It works i think?
10:07
It returns a pointer to Array2D
10:07
Which is what i want
10:07
I do understand pointers
10:07
There is literally nothing confusing about them
10:08
Which doesn't mean it's easy to use them
Avatar
Avatar
pilonpl
I didn't know how to do that i guess
Yeah i think it was easier for me to do it this way
10:19
I guess i can change that
10:21
Does it change anything tho?
Avatar
Avatar
ScReeNy
Dont forget to use the right winning conditions
I actually forgor to check for ending conditions lol
10:26
The discover function could return different value if you discover a mine
10:26
And for win detection
10:26
Maybe separate function
10:27
I need to check is the number of mines == number of undiscovered tiles
10:28
Flags are purely quality of life feature
Avatar
Avatar
pilonpl
It returns a pointer to Array2D
nah u dont want that
Avatar
Why not
10:30
Too many pointers can't hurt
Avatar
u want to return a Array2D by value, the field in the struct data, is a pointer
10:30
the thing is u dont even know what ur doing with that malloc
10:30
its better to assume u dont know than assume wrong btw
10:30
im not home but later ill tell u how
10:31
also on the stack it means basically not a pointer, by value
Avatar
I know
10:32
But
10:32
Returning Array2D by value doesn't change that much really
10:32
On what level is it better? (edited)
Avatar
it does, stack is always faster, also ur malloc is simply wrong, it works due to u over allocating and cuz the array field is last
10:33
sheer luck
10:33
declare the Array2D by value and point data to a malloc of sizeof int x width x height
Avatar
The array field is last because it has to be last. The compiler doesn't allow it to be in the middle
Avatar
i wish there was a language that could manage memory by iteself
Avatar
Avatar
ScReeNy
i wish there was a language that could manage memory by iteself
all GC langs do
10:34
java
Avatar
i expected u to shill rust
Avatar
Avatar
pilonpl
The array field is last because it has to be last. The compiler doesn't allow it to be in the middle
nice, C stuff
10:35
it can be on middle if u declare data as a int* btw
Avatar
Avatar
Ryozuki
it does, stack is always faster, also ur malloc is simply wrong, it works due to u over allocating and cuz the array field is last
Speed isn't that big of deal even on my shit pc. Am i overallocating? I think it's pretty close to the actual size i need
Avatar
which is the same rly
10:35
u said u wanted perfection
10:35
but i see ugliness
10:35
xd
10:35
and wrong stuff
10:36
nah ur over allocating by a lot
Avatar
It is wrong in a sense that it's not optimal
10:36
But it does work technically
Avatar
its not optimal and wrong
10:36
the malloc is wrong
10:36
u know a program can "work" with Ub right?
10:36
but it doesnt mean its correct
10:37
Whats that
Avatar
undefined behavior
Avatar
Avatar
Ryozuki
nah ur over allocating by a lot
width * height * sizeof(int) is what i need for the array, right?
Avatar
its what u need for the field data
Avatar
the other stuff u dont need malloc
Avatar
If i want to have a pointer to Array2D i need malloc
Avatar
why u want a ptr to that
10:39
its 3 ints
Avatar
I can allocate only data and Array2D have as a value
Avatar
Avatar
Ryozuki
why u want a ptr to that
Idk, i probably don't want it if i want to be pro
10:41
But it's like my second ever program in C
Avatar
Array2D* array = malloc(sizeof(Array2D) + width * height * sizeof(int));
10:41
sizeof array2d returns the total size of the struct btw
Avatar
So i basically made something that works kind of and maybe ill improve it later
Avatar
it works by luck
Avatar
Avatar
Ryozuki
sizeof array2d returns the total size of the struct btw
Right and what is it?
10:41
Tbh idk
10:42
I didn't not check that xd
Avatar
its the size of each field of array2d together
10:42
So 64 bit for each field
Avatar
Array2D x; (edited)
10:43
x.width = width
10:43
x.geight = height
10:43
x.data = malloc(sizeof(int) * width * height) (edited)
10:43
return x
10:43
change return type to Array2D
Avatar
Alright
10:45
This is a better solution i guess
Avatar
also u need to make a free method
10:45
that frees x.data
Avatar
It's not like it matters on modern hardware
Avatar
god damn
10:46
u will just make me not help u at this point
10:46
xd
Avatar
I want to understand what makes this better
10:47
It might be faster right
Avatar
ur allocating the correct memory, ur not pointless overallocating on the heap, you free memory u dont need, its how a correct C programmer works
10:47
ask @Learath2
10:48
ur malloc is plain wrong too
Avatar
What do you mean by wrong
Avatar
and that u dont see it means u need to learn a lot
Avatar
It allocates enough memero for the array to fit in
10:49
Maybe even more then enough
10:49
And yeah allocating more memory than needed is technically bad
Avatar
im done
10:49
ima enjoy dinner
10:49
or launch
10:49
i forgot the name
Avatar
What do you not understand xd
10:50
what U dont understand
10:50
and ita pointless to convince someone noob that thinks they right
Avatar
Avatar
Ryozuki
also u need to make a free method
I don't actually need that because i have a lot of ram xd
Avatar
Avatar
Ryozuki
and ita pointless to convince someone noob that thinks they right
But i think you are right
10:51
I just thought you meant my program doesn't work
10:51
Because "wrong" kind of implies that
Avatar
ur program shows a output u expect by luck
10:52
its not correct
Avatar
How is that luck?
Avatar
u can achieve a result by not knowing much what u are doing and think its correct, but a correct program entails more than just a output
10:54
anyway its not just that method
Avatar
I know how much memory i need. I need height * width * sizeof(int) for the data and since i currently allocate the whole Array2D using malloc i need additional sizeof(Array2D)
Avatar
the whole Array2D shows u dont know what u doing
Avatar
So i guess its better to return Array2D by value
10:55
Right?
Avatar
I agree with that
Avatar
u confuse where u need a pointer
10:55
data is the only ptr u need
10:55
I know
Avatar
data[] is equivalent to *data
👎 1
Avatar
But i can create a pointer to whatever i want
Avatar
Avatar
Ryozuki
data[] is equivalent to *data
I know about that
Avatar
but u never point data
10:56
to anywhere
10:56
thata why i say it works by luck
10:56
i think its UB
Avatar
Avatar
pilonpl
But i can create a pointer to whatever i want
So i created a pointer to Array2D and even if it's not a good thing to do it doesn't break anything. I just need to use array->field or (*array).field
Avatar
the pointer u created with malloc also overallocates
10:57
u only need sizeof(Array2D)
10:57
for a ptr to Array2D
10:58
Oh i think i see what you mean
Avatar
and u need to point data to somewhere
10:58
that somewhere is a ptr returned by allocating with malloc
10:58
there is where u use the width and height and size of int
Avatar
I understand how malloc works mostly and how pointers work but I don't know how incomplete types work
Avatar
so if for some reason unwant Array2D as a ptr
10:59
u need 2 mallocs
10:59
there is no incomplete type here
10:59
ur not forward declaring anything
Avatar
Is it not an incomplete type? That's what the compiler said as far as i remember correctly
Avatar
Avatar
pilonpl
I understand how malloc works mostly and how pointers work but I don't know how incomplete types work
u dont based on the code u sent
11:00
dont lie to urself
11:00
its ok, just learn
Avatar
I mean
11:01
I don't understand a lot of things
Avatar
yeah and that's fine
Avatar
But pointers and malloc in theory i know how work
11:01
anyway
Avatar
I don't know how to use them in practice
Avatar
then u dont rly know them
Avatar
Pointers are just a memory address and malloc returns a pointer. How is that difficult?
11:02
What i am confused about are these "incomplete types"
11:03
I had a lot of trouble with those
Avatar
malloc doesnt simply return a pointer
11:03
it allocates a contigous memory region based on the size you give it, aligned properly. then returns a pointer to the start of the region
11:03
the size u pass is wrong
11:04
thus u dont know malloc
Avatar
Avatar
Ryozuki
it allocates a contigous memory region based on the size you give it, aligned properly. then returns a pointer to the start of the region
Yeah i know about that. I think?
11:04
I mean obviously it does some magic
Avatar
not based on the code u sent
Avatar
Avatar
Ryozuki
i think its UB
Maybe data is on the same block of memory as Array2d so allocating that much more for array2d also made some space for data?
Avatar
i cant be a teacher i get annoyed easily xd
11:05
@Chairn how u do this job kek
Avatar
Avatar
Devinci
Maybe data is on the same block of memory as Array2d so allocating that much more for array2d also made some space for data?
That's exactly what i thought, it might be wrong tho
11:05
I didn't think much of it because it worked lol
Avatar
It still looks wrong tho
Avatar
Avatar
Devinci
Maybe data is on the same block of memory as Array2d so allocating that much more for array2d also made some space for data?
ye it works here cuz he overallocates i think, but working doesnt mean correct
11:05
ub can "work"
Avatar
Now i am trying to understand what's wrong but ryozuki just tells me i don't understand anything lol
Avatar
He kinda explained it but with a bit of salt xd
Avatar
Avatar
Ryozuki
ye it works here cuz he overallocates i think, but working doesnt mean correct
Is it actually overallocation when i know i need this memory because that's how C works with these what i think are incomplete types?
Avatar
@Learath2 help
11:07
u can teach better
11:07
i cant i get annoyed
Avatar
What am I teaching?
Avatar
I am trying to understand the issue
Avatar
basic malloc ptr
11:07
check fhis
Avatar
Avatar
Learath2
What am I teaching?
Teach me daddy
Avatar
Holy shit
Avatar
Wait what
Avatar
What's even going on
Avatar
Avatar
pilonpl
Is it actually overallocation when i know i need this memory because that's how C works with these what i think are incomplete types?
It is. Just allocate the correct memory for array2d and then allocate for data. Maybe what you did really works but i've never seen it (edited)
Avatar
What crime did pilonpl commit?
Avatar
check the code i sent
11:09
i mean maybe this works
Avatar
Avatar
Ryozuki
data[] is equivalent to *data
Actually it is you who is wrong this time 😛
Avatar
Avatar
Ryozuki
check the code i sent
You tell me i dont understand anything because i am trying to understand what's wrong. That's the issue, i am not trying to argue what i did is "correct" or anything because it probably isn't. It's literally my second program in C ever.
Avatar
It's a C99 thing, flexible array member
Avatar
So i am not trying to argue against you, i want to understand your point @Ryozuki
Avatar
i guessed that but i wanted to teach it properly
11:11
he doesnt need Array2D on the heap itself
Avatar
That data[] there is not a pointer at all, it's an array of unknown size
Avatar
And i think what i did there is an actual C feature but i am not sure and even if it is I dont argue it's a good practice
Avatar
But then he uses it withouth ever declaring it's size? Or the array2d malloc somehow gave it the size
Avatar
Avatar
Learath2
That data[] there is not a pointer at all, it's an array of unknown size
damned be C and all the hidden stuff
Avatar
Avatar
Devinci
But then he uses it withouth ever declaring it's size? Or the array2d malloc somehow gave it the size
I know it's size because i store it in the struct Array2D
Avatar
Avatar
Devinci
But then he uses it withouth ever declaring it's size? Or the array2d malloc somehow gave it the size
It has no declared size. Flexible array members are as large as whatever is remaining in the malloc
Avatar
Avatar
Learath2
It has no declared size. Flexible array members are as large as whatever is remaining in the malloc
So am i right and this is a feature?
Avatar
its like a field representing the "remaining memory" after the declared fields
Avatar
Yes it is an actual feature
Avatar
Still should use ryozuki's approach
Avatar
And is it good practice?
Avatar
but u need pointer indirection to get width height and size (edited)
Avatar
Avatar
Ryozuki
its like a field representing the "remaining memory" after the declared fields
Yes, it thus has to always be the last member and you should always keep track of it's size
Avatar
and the data itself
Avatar
Oh, so you can't have 2 arrays, data1 and data2 sharing that remaining memory? It's only the last one?
Avatar
i still believe only data should be on heap
Avatar
Avatar
pilonpl
Still should use ryozuki's approach
What did ryozuki suggest? The way you have it is probably better for performance then double indirection
Avatar
Avatar
Ryozuki
i still believe only data should be on heap
Yeah, this is how the common pattern is
Avatar
Array2D by value
11:15
and data as a ptr
11:15
thats what i suggested
Avatar
But locality probably actually means this solution has better performance. Though hard to know without testing
11:16
This pattern is common in stuff like malloc implementations
11:16
Where you want a transparent header and metadata close
Avatar
@pilonpl did u know this feature when u made this
Avatar
Alright so i guess my solution can stay and it's acceptable and ryozuki's solution is good too if not better (that's what I wanted to do originally but didn't for some reason)
Avatar
Avatar
Ryozuki
@pilonpl did u know this feature when u made this
Yes because i found this on the internet
Avatar
anyway my point is getting somehing to work and understanding why it works (and maybe its UB) is different
Avatar
What UB means? Lol
Avatar
undefined behavior
Avatar
And yeah, i understand why it works mostly
Avatar
Be very careful with UB if you are learning C
Avatar
Avatar
Ryozuki
undefined behavior
Oh alright, this is actually defined behaviour i think
Avatar
and please free ur memory
11:18
good practice
Avatar
I will
Avatar
make a hashmap
Avatar
But honestly buy more ram
11:19
I rely on the os to free the memory
Avatar
if u dont free memory, the issue comes at hand on long running programs
11:20
u accumulate leaks
Avatar
It's fine as long as i only have one minesweeper struct
11:20
And that's the case for now
11:20
So
Avatar
learn rust so u dont deal with Ub
11:20
gigachad
11:21
Learning rust isn't a very good way of learning C
Avatar
Avatar
pilonpl
I rely on the os to free the memory
It's good practice to always make sure you free. In library code e.g. you shouldn't rely on the OS
11:21
Or in a freestanding environment
Avatar
Obviously
11:22
Can i just free(array2d)?
Avatar
Avatar
Ryozuki
learn rust so u dont deal with Ub
Too chad
Avatar
C is fun cuz u have lot of control, but easily get lost
11:24
lost deep
11:24
and u may not even know u do smth wrong
Avatar
I am actually surprised i was right after all lol
Avatar
Only like 10 people know flexible array members, I was surprised u knew
Avatar
So actually i am a pro
11:25
pepeW
Avatar
I am on a good path to becoming a hacker
Avatar
make a open addressing hashmap
Avatar
Kernel has a lot of flexible array members too
Avatar
and a red black tree
Avatar
So is everything else ok in the code?
11:34
I think some variable names aren't all that great
11:34
And obviously the discover function could be better
11:37
I don't know how to properly compile a project with raylib tho
11:38
Using only pro tools
11:38
That is command line
11:38
And not a whole ide
11:38
Like visual studio
Avatar
wow this was a long read, so long even I have forgotten what useless piece of information i wanted to share
11:39
It was kind of a useless conversation too
Avatar
keep learning, but internet strangers arent always better
11:39
points* at ryozuki, he might have a nice job, and program daily, but he's quite rusty these days
11:41
@Learath2 meme for the depressed
Avatar
touch woman would be more funny
Avatar
Does touching water count?
Avatar
Avatar
pilonpl
touch woman would be more funny
100%, not touching grass is a choice for most
Avatar
@Learath2 wtf, is that Mountain and Sea scripture?
11:43
looks like really nice location
Avatar
Avatar
Overlord
looks like really nice location
It's off the southern turkish coast
Avatar
just been to czech, so i dont have work holidays anymore, but tell me is this tourist destination? or a nice hidden gem
12:02
would also be good to know how much bread / coca cola cost just so i know the rough prices in turkey (as hair transplant is expensive af)
Avatar
@Bomf
Avatar
Avatar
Overlord
just been to czech, so i dont have work holidays anymore, but tell me is this tourist destination? or a nice hidden gem
It is a tourist destination, around Bozburun. Though it's not quite as fun if you aren't on a boat
Avatar
Avatar
Overlord
would also be good to know how much bread / coca cola cost just so i know the rough prices in turkey (as hair transplant is expensive af)
Bread is 20 cents, 33cl coke is 70 cents (edited)
Avatar
€ cents or $ cents
Avatar
€ cents
Avatar
like full loaf of bread?!
Avatar
Avatar
Overlord
points* at ryozuki, he might have a nice job, and program daily, but he's quite rusty these days
nice one
Avatar
Avatar
Overlord
like full loaf of bread?!
Yes, full loaf
Avatar
damn im skipping japan, going straight to turkey
Avatar
Turkey is extremely cheap for europeans
Avatar
jpn trip costs as much as a good used 125cc motorbike (edited)
Avatar
The plane tickets will also be much much cheaper
Avatar
poland is cheap for europans
12:43
to turkey i would rather go like my ancestors... by car! unless its risky
Avatar
Not risky, the trans european motorway connects turkey to the eu, very decent roads
Avatar
Avatar
Learath2
Does touching water count?
Avatar
i dont have picture of czech's mountain and valleys but they looked dope
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
Everyone on vacations
Avatar
im not really interested by water as i live in tourist area close to sea
12:45
idk how people who dont work in tourism, stand living in areas that constantly have tourists all year round
Avatar
Avatar
Overlord
im not really interested by water as i live in tourist area close to sea
I see water mostly as a nice addition
Avatar
it depends, if it's just sand and sea, or gravel and sea i find it meh, unless the sun hits the clouds just nice
Avatar
Avatar
Learath2
Everyone on vacations
yes but well its just a beach near me (edited)
Avatar
i just realised one thing
14:08
same way as i look at different cultures to be racist accurately
14:09
i should probably find a programming langauge, and desperately argue for it superiority, just so i can take part in more and more arguments
14:10
14:12
probably only fortran looks old and used enough
14:21
BG3 too good xd
14:23
@Robyt3 when leak top 5 animes
Avatar
Avatar
Jupstar ✪
BG3 too good xd
background 3
Avatar
Baldur's Crate
15:02
i just woke up
Avatar
Baldur's Crates.io
Avatar
Mods obligatorios en Baldur's Gate 3, Parte 37
Likes
348
Retweets
101
15:44
with sound
Avatar
Avatar
Jupstar ✪
@Robyt3 when leak top 5 animes
I don't have exact top 5, but these are some of my favorites in no particular order:
  • Mahouka Koukou No Rettousei
  • Sekai Saikou no Ansatsusha, Isekai Kizoku ni Tensei suru
  • Shinsekai Yori
  • Steins; Gate
  • ID INVADED
  • Overlord
  • One Punch Man
  • Shingeki no Kyojin My favorite TV series is definitely Mr. Robot.
Avatar
Avatar
Robyt3
I don't have exact top 5, but these are some of my favorites in no particular order:
  • Mahouka Koukou No Rettousei
  • Sekai Saikou no Ansatsusha, Isekai Kizoku ni Tensei suru
  • Shinsekai Yori
  • Steins; Gate
  • ID INVADED
  • Overlord
  • One Punch Man
  • Shingeki no Kyojin My favorite TV series is definitely Mr. Robot.
good taste
Avatar
Avatar
Robyt3
I don't have exact top 5, but these are some of my favorites in no particular order:
  • Mahouka Koukou No Rettousei
  • Sekai Saikou no Ansatsusha, Isekai Kizoku ni Tensei suru
  • Shinsekai Yori
  • Steins; Gate
  • ID INVADED
  • Overlord
  • One Punch Man
  • Shingeki no Kyojin My favorite TV series is definitely Mr. Robot.
@Ryozuki see robyte is a fellow
Avatar
tv series too
15:50
shinsekai yori is nice
15:50
@Robyt3 have u watched monogatari
Avatar
Avatar
Ryozuki
@Robyt3 have u watched monogatari
no
Avatar
recommended
15:51
watch like this
15:51
Bakemonogatari (2009) Nisemonogatari (2012) Nekomonogatari (2012) Monogatari Series: Second Season (2013) Hanamonogatari (2014) Tsukimonogatari (2014) Owarimonogatari I (2015) Kizumonogatari I: Tekketsu-Hen (2016) Koyomimonogatari (2016) Kizumonogatari II: Nekketsu-Hen (2016) Kizumonogatari III: Reiketsu-Hen (2016) Owarimonogatari II (2017) Zoku Owarimonogatari (2018) (edited)
Avatar
ah yes, when you need a guide to watch it in the correct order 😄
Avatar
u know its good then
Avatar
I think I had it on my list at some point
Avatar
naah but fr
15:52
it has epic animation, epic plot, and its those that are like misterious and philosophical
15:52
and its rly weeb
15:52
Avatar
really mahouka koukou is considered good nowdays, god how the mighty have fallen
15:52
15:52
Avatar
btw im not attacking robyt but ryozuki with the "good taste"
15:52
as robyt said its his favorites
15:52
so he can favorite anything
Avatar
I also have the Mahouka novel
15:53
Because I like the technical details about magic programming
Avatar
is it any better than animation? i remember tatte no yusha narigari? was worst novel i ever read
15:53
tatte no yusha is new
15:53
watch planetes
15:54
15:54
old anime hits diferent fr
Avatar
im talking novel
15:54
i read novel in 2014?
15:54
or so
Avatar
Avatar
Overlord
is it any better than animation? i remember tatte no yusha narigari? was worst novel i ever read
Depends on what you are looking for, I'd say they didn't cut much action from the anime but mostly background and technical information about the world and magic
Avatar
my favorite anime died
15:54
the last 2 episodes ago
Avatar
no game no life
15:54
sad we will never see s2
Avatar
One Piece turned into a cartoon
15:55
for no apparent reason
15:55
(that's no joke)
Avatar
Avatar
Ryozuki
no game no life
I also read all of the novels
15:55
Also waiting for season 2 feelsbadman
Avatar
@Robyt3 do u read manga
15:56
did u read oyasumi punpun
15:56
Avatar
No, haven't read much manga
15:56
ur weird weeb
15:56
ln and anime
15:56
but no manga
Avatar
I rarely read
Avatar
i havent read ln
15:57
i like the drawings
15:57
boobas u know
15:57
joking
Avatar
i feel robyte
Avatar
or not
Avatar
i never read a book in my entire life XDD
Avatar
well ppl say manga is not a book
Avatar
I mostly read in the bus or train so I prefer PDFs
Avatar
manga is definitly less booky than a LN
15:57
manga is perfect for train
Avatar
nintendo DS is better
Avatar
i read manga on mobile
15:58
Read manga online for free on MangaDex with no ads, high quality images and support scanlation groups!
Exported 450 message(s)