Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the "s" mean in the structure?

Here's a simple question. What's the meaning of the leading letter "s" in the sin_family, sin_port, sin_addr and sin_zero?

struct sockaddr_in {
    short int          sin_family;  // Address family, AF_INET
    unsigned short int sin_port;    // Port number
    struct in_addr     sin_addr;    // Internet address
    unsigned char      sin_zero[8]; // Same size as struct sockaddr
};

Thanks.

like image 416
smwikipedia Avatar asked Feb 11 '11 14:02

smwikipedia


People also ask

What does S mean in organic chemistry?

A counterclockwise direction is an S (sinister, Latin for left) configuration. A clockwise direction is an R (rectus, Latin for right) configuration.

What is S and R configuration?

R configuration is the spatial arrangement of R isomer. S configuration is the spatial arrangement of S isomer. Priority of Substituents. R isomer has its relative direction of the priority order in the clockwise direction.

How do you know if a molecule is R or S?

Because the 4th highest priority atom is placed in the back, the arrow should appear like it is going across the face of a clock. If it is going clockwise, then it is an R-enantiomer; If it is going counterclockwise, it is an S-enantiomer.

How do you assign S or R?

Draw an arrow starting from priority one and going to priority two and then to priority 3: If the arrow goes clockwise, like in this case, the absolute configuration is R. As opposed to this, if the arrow goes counterclockwise then the absolute configuration is S.


2 Answers

This comes from Berkeley, back when LSD was still legal. So very obvious in their naming choices :/

All kidding aside, this dates back to very early K&R C where structure members didn't have their own namespace. Which required you to come up with distinct names for the structure members that wouldn't collide with identifiers in the global namespace. Painful. Prefixing the names with an abbreviation of the structure name was the common approach.

Thus "sockaddr_in" becomes "sin".

Note how enums still have this problem today, not untypically solved the same way.

like image 88
Hans Passant Avatar answered Sep 18 '22 08:09

Hans Passant


sin is repeating the name of the sockaddr_in structure, i.e. Socket INternet.

like image 42
John Kugelman Avatar answered Sep 19 '22 08:09

John Kugelman