#
#asahi · 2023-10-08 11:54
ydaltonwouldn't a function set it to 0 or non zero?
#asahi · 2023-10-08 11:54
chadmedit was being initialised to a nonzero value
#asahi · 2023-10-08 11:54
ydaltonwait, how?
#asahi · 2023-10-08 11:53
chadmedits silly, we ran into some odd behaviour in the opp-microwatt handling code because someone had done int ret; and not int ret = 0;
#asahi · 2023-10-08 11:53
ydaltonmakes sense
#asahi · 2023-10-08 11:52
j`eyalso it's the style of code because 90% of code was written before that was allowed
#asahi · 2023-10-08 11:51
ChaosPrincessi think checkpatch.pl complains, and people on mailing lists did too when i accidentally forgot that
#asahi · 2023-10-08 11:48
ydaltonunless i'm blind lol
#asahi · 2023-10-08 11:48
ydaltonis it? i don't see it in this document https://www.kernel.org/doc/html/latest/process/coding-style.html
#asahi · 2023-10-08 11:45
ChaosPrincessits kernel code style
#asahi · 2023-10-08 11:45
ydaltonthat's just for readability's sake right?
#asahi · 2023-10-08 11:44
ydaltonyet a lot of kernel code i see still declares variables at the beginning of scope even though it's not required anymore
#asahi · 2023-10-08 11:44
ydaltoninteresting
#asahi · 2023-10-08 11:39
psykoseyep, also c99
#asahi · 2023-10-08 11:38
j`eyvery modern
#asahi · 2023-10-08 11:38
j`eythe kernel builds as C11 now!
#asahi · 2023-10-08 11:37
ydaltonthat's also c99 i think
#asahi · 2023-10-08 11:37
ydaltonthat's a dime a dozen in the kernel
#asahi · 2023-10-08 11:37
ydaltonstruct file_operations fops = { .open = foo_open, .read = foo_read };
#asahi · 2023-10-08 11:36
ydaltonand also this thing
#asahi · 2023-10-08 11:36
ydaltonah
#asahi · 2023-10-08 11:36
psykose= {}; (same thing) is c23
#asahi · 2023-10-08 11:35
psykose{0} is c99
#asahi · 2023-10-08 11:35
ydalton"relatively" new
#asahi · 2023-10-08 11:34
ydalton{0} is kind of a new thing right?
#asahi · 2023-10-08 11:34
psykosethe lack of consistency isn't surprising
#asahi · 2023-10-08 11:33
ydaltonbut i mean if you just stack allocate a struct you would either do memset or {0}
#asahi · 2023-10-08 11:33
ChaosPrincessheap
#asahi · 2023-10-08 11:33
ydaltonkzalloc is a heap allocator no?
#asahi · 2023-10-08 11:32
ydaltonunless you stack allocate or heap allocate
#asahi · 2023-10-08 11:31
psykoseor maybe that was just allocs
#asahi · 2023-10-08 11:31
psykoseit can totally be off
#asahi · 2023-10-08 11:31
psykosei thought struct zero init was a toggle?
#asahi · 2023-10-08 11:31
ChaosPrincessisnt it usually on code that was written before kzalloc became a thing
#asahi · 2023-10-08 11:31
ydaltonmaybe i could set that up myself
#asahi · 2023-10-08 11:31
ydaltonwould like to see a elixir bootlin-style asahi linux kernel source explorer!
#asahi · 2023-10-08 11:30
ydaltonhm, but i see memset being used sometimes
#asahi · 2023-10-08 11:29
psykosehttps://github.com/torvalds/linux/blob/b9ddbb0cde2adcedda26045cc58f31316a492215/drivers/mfd/rsmu_spi.c#L28 etc
#asahi · 2023-10-08 11:29
psykoseyes
#asahi · 2023-10-08 11:28
ydaltons/strcuts/structs
#asahi · 2023-10-08 11:28
ydaltondoes C in the linux kernel support zeroing out strcuts with {0}?
#asahi · 2023-10-08 11:26
ydaltonbut that excuse is overused
#asahi · 2023-10-08 11:25
ydaltonmaybe to prevent spamming
#asahi · 2023-10-08 11:25
ydaltonagreed
#asahi · 2023-10-08 11:25
psykoseya
#asahi · 2023-10-08 11:25
ChaosPrincessalso fuck that mba asshole who decided to lock search behind login
#asahi · 2023-10-08 11:25
psykose(sometimes)
#asahi · 2023-10-08 11:25
psykosebut these days you can have any random app, and the search will just not find a string
#asahi · 2023-10-08 11:25
psykosefor kernel sized sure
#asahi · 2023-10-08 11:25
chadmed"sorry you cant search forks" piss off

plus ›