Re: [AOLSERVER] Naviserver Win-64 Sources
Dear Jeff, Thank you very much for your remarks. I would like to share what I think. 2.a Of course we are talking about C files and not C++ files, so any compiler will accept the sources as they are (at least till now). But the point here I believe is making the codebase easy to read and maintain. Nowadays programmers (unlike us I am afraid - I am 52 years old) are used to C++ more than C; so trying to use the common subset between ISO C e C++ standard make sense. If I take gcc and I compile the code with the option "-Wc++-compat" I get a warning for every ISO C construct that is outside of the common subset of ISO C and ISO C++, e.g. request for implicit conversion from void * to a pointer to non-void type. So that is an effort in making the code easily readable by programmers (not compilers) with C++ background. 2.b Shocking? Have a look at the file "tclXkeylist.c"... The same construct is used here and there in other places (look at the diffs). 2.c Well the new STD 201X defines as keyword (see section 6.4.1) "_Bool", but there's a macro definition converting "bool" to "_Bool" . For "new" and "delete" the point is once again avoiding mismatches between C and C++, causing confusion to a reader/programmer/maintainer with a C++ mindset. Summing up: 1. I have done a static code analysis of all the codebase. 2. I have identified these discrepancies and corrected all of them 3. This makes the overall system easier to read and to maintain BTW: 90% of my current business (bread and butter) comes from doing this type of analysis on various systems. Most of the time it is for embedded systems used in avionics applications. There the language is mostly Ada and not C or C++. Hope it clarifies my point, Maurizio -Original Message- From: Jeff Rogers [mailto:dv...@diphi.com] Sent: 16 October 2012 01:38 To: Maurizio Martignano Cc: aolserver-talk@lists.sourceforge.net Subject: Re: [AOLSERVER] Naviserver Win-64 Sources Maurizio Martignano wrote: > 2.A set of necessary cosmetics/make up changes to the overall code > base to make it more compliant with nowadays C STDs, and therefore > more "acceptable" to nowadays C compilers, they are: > > a.I have made explicit all type conversions (with explicit casts) > > b.I have modified all functions defined in K&R C STD, changing them > into ANSI C STD > > c.I have removed from the code base all reserved words, e.g.: new, > delete, bool . Are you building with a C compiler or a c++ compiler? new, delete, and bool are not reserved words in any dialect of C that I'm aware of. C++ is also pickier about casting; in C you should be able to cast any pointer to or from a void* without a cast. The K&R definitions can go; It's somewhat shocking there would be any still around. -J -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
Re: [AOLSERVER] Naviserver Win-64 Sources
Maurizio Martignano wrote: > 2.A set of necessary cosmetics/make up changes to the overall code base > to make it more compliant with nowadays C STDs, and therefore more > “acceptable” to nowadays C compilers, they are: > > a.I have made explicit all type conversions (with explicit casts) > > b.I have modified all functions defined in K&R C STD, changing them > into ANSI C STD > > c.I have removed from the code base all reserved words, e.g.: new, > delete, bool … Are you building with a C compiler or a c++ compiler? new, delete, and bool are not reserved words in any dialect of C that I'm aware of. C++ is also pickier about casting; in C you should be able to cast any pointer to or from a void* without a cast. The K&R definitions can go; It's somewhat shocking there would be any still around. -J -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
[AOLSERVER] Naviserver Win-64 Sources
To facilitate the discussion, I put in here some examples of the changes I made: 2.a. From mapPtr = ns_malloc(sizeof(Map)); To mapPtr = (Map *) ns_malloc(sizeof(Map)); 2.b. From int TclX_WrongArgs (interp, commandNameObj, string) Tcl_Interp * interp; Tcl_Obj * commandNameObj; char * string; { To int TclX_WrongArgs (Tcl_Interp * interp, Tcl_Obj * commandNameObj, char * string) { 2.c From if (new) { To if (mm_new) { All these changes have been applied everywhere. Dear all, While the tests seem to go rather well but are not finished yet (and it will take quite some time), I have decided to make available anyhow the result of my activity. The sources (and Visual Studio 2012 project files) are available at: http://www.spazioit.com/software/naviserver-4.99.4-Win64.zip There are two categories of changes: 1. The ones required to have the system compiled by Visual Studio 2012 using as target Windows 64. They are identified by the #ifdef _WIN64 clause. 2. A set of necessary cosmetics/make up changes to the overall code base to make it more compliant with nowadays C STDs, and therefore more "acceptable" to nowadays C compilers, they are: a. I have made explicit all type conversions (with explicit casts) b. I have modified all functions defined in K&R C STD, changing them into ANSI C STD c. I have removed from the code base all reserved words, e.g.: new, delete, bool . These changes make the entire codebase less "old-style" and more maintainable in the future. Hope it helps, Maurizio -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
[AOLSERVER] Naviserver Win-64 Sources
Any comment? Dear all, While the tests seem to go rather well but are not finished yet (and it will take quite some time), I have decided to make available anyhow the result of my activity. The sources (and Visual Studio 2012 project files) are available at: http://www.spazioit.com/software/naviserver-4.99.4-Win64.zip There are two categories of changes: 1. The ones required to have the system compiled by Visual Studio 2012 using as target Windows 64. They are identified by the #ifdef _WIN64 clause. 2. A set of necessary cosmetics/make up changes to the overall code base to make it more compliant with nowadays C STDs, and therefore more "acceptable" to nowadays C compilers, they are: a. I have made explicit all type conversions (with explicit casts) b. I have modified all functions defined in K&R C STD, changing them into ANSI C STD c. I have removed from the code base all reserved words, e.g.: new, delete, bool . These changes make the entire codebase less "old-style" and more maintainable in the future. Hope it helps, Maurizio -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
[AOLSERVER] Naviserver Win-64 Sources
Dear all, While the tests seem to go rather well but are not finished yet (and it will take quite some time), I have decided to make available anyhow the result of my activity. The sources (and Visual Studio 2012 project files) are available at: http://www.spazioit.com/software/naviserver-4.99.4-Win64.zip There are two categories of changes: 1. The ones required to have the system compiled by Visual Studio 2012 using as target Windows 64. They are identified by the #ifdef _WIN64 clause. 2. A set of necessary cosmetics/make up changes to the overall code base to make it more compliant with nowadays C STDs, and therefore more "acceptable" to nowadays C compilers, they are: a. I have made explicit all type conversions (with explicit casts) b. I have modified all functions defined in K&R C STD, changing them into ANSI C STD c. I have removed from the code base all reserved words, e.g.: new, delete, bool . These change make the entire codebase less "old-style" and more maintainable in the future. Hope it helps, Maurizio -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk