saprykin / plibsys

Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance.
MIT License
672 stars 74 forks source link

va_copy #61

Closed jddurand closed 6 years ago

jddurand commented 6 years ago

I do not really know how to fulfill your coding style, nevertheless you'll get the idea: have a p_va_copy available everywhere.

codecov-io commented 6 years ago

Codecov Report

Merging #61 into master will decrease coverage by <1%. The diff coverage is n/a.

@@          Coverage Diff           @@
##           master    #61    +/-   ##
======================================
- Coverage      88%    88%    -1%     
======================================
  Files          41     41            
  Lines        3848   3848            
  Branches      781      0   -781     
======================================
- Hits         3421   3417     -4     
- Misses        427    431     +4
saprykin commented 6 years ago

Good point with varargs.h. Am I right that stdarg.h is a newer implementation and is recommended for usage? We can actually detect the presence of these headers and chose stdarg.h if available, if not - try to use varargs.h. Similar situation with values.h and limits.h. Exactly the same solution was used: use limits.h first (if available), or values.h as plan B. Can we implement the same approach in our case?

jddurand commented 6 years ago

Nope, the semantic is not the same. IMHO this is asking for trouble. varargs still exist only to not break dinosaur-aged programs, and is officially discouraged since decennies -; But it is still here unfortunately.

saprykin commented 6 years ago

Started to check on various operating systems. Some results:

Unfortunately, I do not have access to the rest of VMs right now, thus I will continue testing after January 9.

I decided to stick with stdarg.h, which is a part of C89. I think it is old enough to demand it for any target platform. I also added a note about compatibility with varargs.h to make it clear.