HP-UX to Linux Migration
Currently I am working on the project where I have to migrate all the C code from HP-UX to Red-Hat Linux. There are lot of differences and I need lot of code change.
I am looking for the forum where this type of discussion happen before, and I can post my problems.
I am having a list of items which need some discussion.
I've done a lot of cross-platform C/C++ devlopment over the years, including HPUX, Linux, Solaris, AIX, Tru64, Windows, QNX, etc. Post your issues here and I'll try to help, though bear in mind I don't have an HPUX system (PA-RISC or Itanium) to test things on at the present. Which HPUX version are you porting from, and which RHEL version are you porting to?
Thanks for the reply.
Right now I am on planning phase and identifying the list of problems.
It's a quit big list.
I will send the details shortly the exact version of RHEL and HPUX.
Let's discuss items one by one:
Follwing code working perfect under HPUX but crashing under Linux.
Actually code is broken, but HPUX may be doing something extra and not getting crashed.
char *b = NULL;
In case b is not having malloc this should crash, but in HP it's not crashing. Now we are having more than 20,000 file of C code, and lot of string operation. To check all the string function and correct is if needed will take lot of time.
Well, 20 KLOC isn't so much. I've had to review and fix as much as 10 MLOC for similar issues in the past. I would estimate 2-5 person-days to remediate your code. This is a situation where asserts (assert()) and building/testing in debugging mode can be very useful in that it will reveal most of the offenders right off. Then, you know which ones to fix and can rebuild at the end with debugging off for production.
In any case, you are correct in that it should also fail with HPUX, but that depends upon the C runtime library. The strcpy() and similar functions can test the passed arguments for null values and do nothing if found. That is optional in the C/C++ standards, but not required. So, both behaviors can be considered acceptable. This is one of those things that bite you when building/running code in a cross-platform sense, and makes a strong case for code review and strong local coding standards.
I would say it makes a strong case for coding everything explicitly and not relying on any built-in intelligence in the compiler. Because a different compiler might make different assumptions or none at all. If you want to store strings or anything else, use malloc() first and your code will run on any system.
Originally Posted by Rubberman
Yes, you suggestion is perfect, but code is existing may be some of them are 15 year old. Now I need to find all the bugs.
Is there any place where guys discuss the difference between HPUX and Linux?