Click here to Skip to main content
16,004,031 members

Comments by Member 13002551 (Top 4 by date)

Member 13002551 15-Feb-17 10:04am View    
You need to pass -Wstrict-aliasing=2 flag because -fstrict-aliasing option is default, not the -fnostrict-aliasing option. Dereferencing will be eventually done by bind() method and somewhere by me in my library, otherwise what's the use of packing it..
Member 13002551 15-Feb-17 9:49am View    
my code has commented lines to bind() call, but if you uncomment them it will show them. otherwise another example here - https://godbolt.org/g/SMCdSk
Member 13002551 15-Feb-17 8:12am View    
Compiler disagrees - x86-64 gcc 7 (snapshot)!!warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing]
Member 13002551 15-Feb-17 8:07am View    
The sole existence of sockaddr_storage is in case you want to make domain unaware functions eg same function send() for ipv4, ipv6, sockaddr_un and alike, which is what I'm doing. Are you saying the code containing casts that I provided doesn't break strict aliasing rule? The char* cast is because char is the only type that aliases with any other type.