[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: Tumblr_l_32958200559508.gif (3.77 MB, 1665x1617)
3.77 MB
3.77 MB GIF
previous: >>108180698

#define __NR_getsockname        51
#define __NR_getpeername 52

https://man7.org/linux/man-pages/man2/getsockname.2.html
https://man7.org/linux/man-pages/man2/getpeername.2.html

god, i am so ready to be done with sockets. no one here cares about them...
these two feel like especially useless syscalls. like sure they're handy for something, i guess, but god. just feels like a waste of space. it at least showcases C's
restrict
keyword, which is pretty cool. i like that keyword
on a tangentially related note, i have been const qualifying a lot more of my pointers recently (as in, const pointer, not pointer to const)
i basically use it in the same way that you'd use a C++ reference, where i only ever expect to be passed a pointer because someone took the address of a variable. looks breddy nice. i haven't bothered with restrict, because it seems like that would start to get too wordy, but maybe i can typedef or macro something into a ref_t, lol. could probably even add some type of static assert to ensure that it's actually an address and not a raw pointer
hardly related to sockets, i realize, but the threads keep dying early, so maybe this will help

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
>>
>>108189613
I did not expect her to bump her stupid head on the camera. Kek'd.
>>
>>108189631
i believe it's supposed to be the uhh, god what the fuck are they called. peephole. the peephole on a door
>>
>>108189649
I know! That's what makes it even dumber. Didn't she see the fucking door? Kek.
>>
>>108189613
Why do they even use restrict here?
>>
>>108190504
to gatekeep the retards
>>
>>108190504
doesn't restrict guarantee that no other thread has an alias to the pointer and changes it mid execution?
>>
>>108190504
because you should be using restrict literally everywhere it's possible to if you're writing a standard library. makes it far more efficient
>>
File: schapu.jpg (11 KB, 221x270)
11 KB
11 KB JPG
>>108189613
>syscall of the day
i hate you so much for being a nerd, yet i hope you succeed in life and have a long and healthy, and fullfilling life.

keep up these threads, nerd, you are doing good work, and i hate you for it.
(seriously, good job, i like these threads and the idea behind them)
>>
>>108192047
>>108192984
i'm a rertard, but, from what both of you are saying, its to protect the memory, no?
(lietrally retarded)
>>
>>108193200
it lets the compiler make assumptions about the safety of accessing the memory, which allows it to generate more efficient code
some good examples:
https://stackoverflow.com/questions/745870/realistic-usage-of-the-c99-restrict-keyword
https://en.wikipedia.org/wiki/Restrict#Optimization



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.