Like Tree2Likes
  • 1 Post By jimblumberg
  • 1 Post By Codeplug

AIX To Linux Migration

This is a discussion on AIX To Linux Migration within the C++ Programming forums, part of the General Programming Boards category; Hi All, We are currently migrating C++ code from AIX to Linux. Visual Age C++ was the compiler used in ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    3

    Question AIX To Linux Migration

    Hi All,

    We are currently migrating C++ code from AIX to Linux.
    Visual Age C++ was the compiler used in AIX whereas g++ is used in Linux.
    There are many pragmas used in the current code in AIX. We are looking for their equivalent in g++. If anyone has any idea regarding this, kindly update..

    Some of the pragmas used in the code are given below,
    #pragma object_model (compat)

    #pragma info(none)
    #pragma report(level, E)
    #pragma info(restore)

    #if __IBMCPP__ >= 400
    #pragma namemangling(compat)
    #endif

    #pragma enum(int)
    #pragma options align = power
    ....
    #pragma options align = reset

    #pragma enum(pop)
    #pragma report(pop)
    #pragma info(restore)

    #if __IBMCPP__ >= 500
    #pragma namemangling(pop)
    #endif

    Thanks & Regards,

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,679
    I would start with comparing these two links: IBM pragma descriptions and GCC Option Summary.

    Jim
    Salem likes this.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    3

    Question

    Hi Jim

    I had also compared the options provided by both the compilers but couldn't find the exact options to be used in g++ for the pragmas that I have given in my earlier post.

    It will be very helpful if you can provide any information related to this.

    Thanks

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    2,679
    I doubt very much that you will find "exact" matches. You need to find the closest match.

    It will be very helpful if you can provide any information related to this.
    I suggest you carefully read the descriptions of the IBM pragmas and then find the gcc equivalent settings.
    For example for #pragma report(level, E) the relevant section of gcc is: Options to Request or Suppress Warnings. And I would recommend that you start by using higher warning levels than the original program.


    Jim

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,630
    I'd say you can skip all of those for the g++ build.

    gg

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    I'd second codeplug's answer.
    Just delete the whole mess of #pragma's (most seem like ugly hacks anyway) and see what a nice clean compile does for you.

    Post your results.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Nov 2011
    Posts
    3
    We cannot actually skip all the pragmas.

    For eg: In the code we have,

    Code:
    #pragma options align=packed
    
    struct s1{
      long l;
      short s;
      char c[9];
    };
    
    struct s2{
    ...
    ...
    };
    
    ....
    
    #pragma options align=reset
    In this case if we skip these pragmas and compile using g++, there won't be any compilation error but the data that we get while executing the program will be incorrect since packing is not done.
    Last edited by Testing; 11-09-2011 at 02:28 AM.

  8. #8

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    An opportunity then to improve the code so that it no longer depends on arbitrary "pack" features of a compiler.

    For one thing, if you move to another architecture with a different endian, then you're screwed anyway, as there is no pragma to sort that mess out.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Registered User
    Join Date
    Mar 2009
    Posts
    343
    Good point. If you're using struct packing to make sure I/O is efficient, it's better to do it using some smarts in the serialization instead of forcing the IO format to match the in-memory version. If you're doing it to optimize memory usage, it's probably premature to do so when jumping to a new compiler. If you're trying to do something else, ask and we may have ideas.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Upcoming server migration
    By webmaster in forum General Discussions
    Replies: 2
    Last Post: 04-14-2011, 06:00 AM
  2. C to C++ migration for typedef struct
    By alexy01 in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2008, 12:35 PM
  3. good ide for linux ( mandriva linux )
    By abhijeetnayak in forum Linux Programming
    Replies: 3
    Last Post: 05-28-2006, 05:49 AM
  4. i'm new to linux - which linux to install?
    By wakish in forum Linux Programming
    Replies: 38
    Last Post: 02-27-2006, 11:40 AM
  5. Replies: 3
    Last Post: 09-22-2003, 09:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21