From: Michael Widenius Date: March 27 2008 9:21am Subject: re: my_socket that's useful in detecting portability breakage List-Archive: http://lists.mysql.com/internals/35461 Message-Id: <18411.26389.222769.462365@narttu.mysql.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Stewart" == Stewart Smith writes: Stewart> Here's an idea/patch I've had floating about that I'm going to bring Stewart> into the ndb on Windows tree. Stewart> basically does this: Stewart> typedef struct { int fd; } my_socket; Stewart> to give build errors when you go use close() on a socket instead of Stewart> socketclose() etc. Stewart> i.e. turns subtle portability bugs into compile errors. Stewart> More complete patch to come (i.e. one that actually builds the whole Stewart> server). Stewart> I'd quite like thoughts/ok on this though. I think the basic idea is fine. The only suggestions I have are the following: - Instead of having 3 include files for sockets, do it with one. ie, let my_socket.h handle all cases with ifdefs. (Makes it easier to understand the socket interface with one glance) In my_gobal.h, remove the ifdefs for close_socket() and socket_errno and change all code to use the new my_socket() calls. (No reason to have two indirections for the same thing). Regards, Monty