Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C over the years

Name: Anonymous 2015-07-24 1:45

Does anyone know why did the definitions of many functions in the C standard library got changed to return ssize_t instead of int? For instance read and write, both returning -1 in case of error, whilst all declarations of ssize_t I've seen are unsigned. What is this crazyness?

Name: Anonymous 2015-07-24 2:28

read(2) and write(2) were never in the C standard library; those niggas been rollin' POSIX since it got borned.

Name: Anonymous 2015-07-24 2:44

>>2
Yes I'm sorry I didn't mean the standard library; they are identified as important system calls in the ANSI standard, how is a thing like that changed with an unsigned return type??!

Name: Anonymous 2015-07-24 2:51

>>3
Where I'm sitting, ssize_t is defined in terms of __SWORD_TYPE, which is int for 32-bit and long int for 64-bit platforms. So it's signed; materially the only change from returning int is that there may be large return values on 64-bit plats. This is reasonable because the size parameter can also be large on 64-bit.

Name: Anonymous 2015-07-24 3:05

>>4
How can DA STANDARD enumerate sword types when C doesn't have any support for symbolic programming?

Name: Anonymous 2015-07-24 3:11

>>5
Dude, my katana can cut through all your symbols.

Name: Anonymous 2015-07-24 9:35

>>3
they are identified as important system calls in the ANSI standard
What?

how is a thing like that changed with an unsigned return type??!
I have never seen a implementation where ssize_t is a unsigned.

Personally I never understood what is the point of ssize_t if SSIZE_MAX is less than SIZE_MAX (line in the most systems).

Name: Anonymous 2015-07-24 10:58

>>7
I think >>1 could actually be super-dyslexic. Unless she copy-pasted all mentions of ssize_t, it means that she somehow managed to write it correctly despite reading it incorrectly. As if her mind exists in the mind of another being, or maybe contains another parasitic mind with root access, that filters certain aspects of reality from her while still ensuring perfect roundtripping.

Name: Anonymous 2015-07-24 19:11

>>1,7-8
ssize_t literally stands for "signed size type".

I suspect the lack of any requirement that it be able to represent any value that can be represented by a size_t is a historical artifact. In the beginning, there was no ssize_t, everyone just used long instead. Hence, any functions that were subsequently redefined to use ssize_t have to use a type that is compatible with long, to avoid breaking existing applications. Since the POSIX standard also has no requirement that a long be able to represent all values that can be represented with a size_t, the standard is stuck at this impasse forever.

Name: Anonymous 2015-07-24 23:56

>>9
everyone just used long instead
everyone just used int instead

Hence, any functions that were subsequently redefined to use ssize_t have to use a type that is compatible with long
ssize_t is 32 bits in 32 bit linux, unlike long if I am not mistaken.

Name: Anonymous 2015-07-25 3:43

>>10
You are mistaken. Historically, Unix used long for the return values of read and write, not int.

long on Linux i386 is 32 bits, not 64 bits. If you want a 64 bit signed type on i386, you must use long long.

Name: Anonymous 2015-07-25 9:59

>>11
Nice dubs dubs

Name: Anonymous 2015-07-25 12:43

>>11
You are right, I am mistaken. I was confused with windows where even at x86-64 long is still 32 bit.

Name: Anonymous 2015-07-25 13:30

>>13
On linux every target architecture with 64bit addresses have long and long long the same size, 64 bits. Anyways you have fixed length integer types in the C99 standard, the same standard that introduced long longs.

Name: Anonymous 2015-07-25 19:31

>>14
I was aware of that.

Name: Anonymous 2015-07-26 7:43

>>15
But were you aware of this?
*unzips dick*

Name: Anonymous 2015-07-27 14:08

>>16
Why do you have a zipper on your dick?

Name: Anonymous 2015-07-27 17:48

>>16
I hope it was LZMA encoded.

Name: Anonymous 2015-07-27 20:33

>>17
Oh god I'm laughing so hard at this. I should probably kill myself right now.

Name: XML makes Java the 2015-07-27 21:34

>>19
XML makes Java the "acceptable lisp"

Name: Anonymous 2015-07-27 22:10

>>21
*unzips vagina*

Name: Anonymous 2015-07-27 23:10

>>22
*checks dubs*

Name: Anonymous 2015-07-27 23:51

Zipping dicks considered harmful

Name: Anonymous 2015-07-28 0:27

*quickly zips up anus*

Name: Anonymous 2015-07-28 3:26

ZIP MY ANUS

Don't change these.
Name: Email:
Entire Thread Thread List