public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: <llewelly@198.dsl.xmission.com>
To: Jayakrishnan J <j.jayakrishnan@sisl.co.in>
Cc: "Gcc-Help (E-mail)" <gcc-help@gcc.gnu.org>
Subject: Re: Compiling legacy code
Date: Mon, 07 Feb 2000 22:27:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.10.10002072253500.11999-100000@198.dsl.xmission.com> (raw)
In-Reply-To: <892CE977BB4FD31194EE00A0C9F2733975E231@BLRK001A>

On Tue, 8 Feb 2000, Jayakrishnan J wrote:

> Hi,
> I have some C++ code (from way back) that was earlier compiled on gcc 2.7.2
> Now, we have decided to recompile it using the latest version of gcc.
> The C++ code uses some RogueWave classes (6.1.0)
> 
> What are the necessary changes I need to make so as to be able to
> recompile my code with the latest version of gcc.
> 

Well, I don't know all the difficulties you will encounter, but here are
  few I have come across:

Conversions such as:

  char* => char const*  
  signed char* => char* , unsigned char* => char* , etc
  signed T* => unsigned T* and its reverse

  are illegal in gcc 2.95.x . Earlier
  versions of gcc either generated warnings, or silently permitted them. 

I don't remember if 2.7.2 accepted k&r style function decls and defs in
  c++ mode, but g++ 2.95.2 definitely will not.

const foo=1;

  is now illegal; change it to 'const int foo;' .

I think there have also been some changes to declaring  friends of
  templated classes. I don't remember how to do it under 2.7.2, but 2.95.2
  accepts the following:

template<typename T> class A;

template<typename T> class B;

template<typename TT>
  class Foo
  {
  public:

    //A typical binary friend operator:
  friend bool operator==<>(Foo const& ,Foo const& );

    //Making *all* instances of template class A friends.
  template<typename X> friend class A;

    //Making *only* B<TT> a friend.
  friend class B<TT> ;
  };

See http://gcc.gnu.org/gcc-2.95/caveats.html for other possible
  difficulties.

You may be able to improve the design and or readablity of the old code
  due to the fact that 2.95.2 has much better support for many c++
  features, especially templates. See http://gcc.gnu.org/gcc-2.95/c++features.html
  for details. (Be aware that gcc 2.95.2 may be ahead of some older
  compilers you may need to keep supporting.)

If you have some code you *cannot* convert, try -fpermissive on it; this
  will make g++ accept lots of now obsolete constructs. I have friends who
  needed -fpermissive to make X apps written in C++ compile on Solaris
  (which has very old X headers appearently).

WARNING: multiple messages have this Message-ID
From: <llewelly@198.dsl.xmission.com>
To: Jayakrishnan J <j.jayakrishnan@sisl.co.in>
Cc: "Gcc-Help (E-mail)" <gcc-help@gcc.gnu.org>
Subject: Re: Compiling legacy code
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.10.10002072253500.11999-100000@198.dsl.xmission.com> (raw)
Message-ID: <20000401000000.rbb3Ke9mSWxMwxQwq4vrg4hAJnPBELHdfWkfHf_BAYI@z> (raw)
In-Reply-To: <892CE977BB4FD31194EE00A0C9F2733975E231@BLRK001A>

On Tue, 8 Feb 2000, Jayakrishnan J wrote:

> Hi,
> I have some C++ code (from way back) that was earlier compiled on gcc 2.7.2
> Now, we have decided to recompile it using the latest version of gcc.
> The C++ code uses some RogueWave classes (6.1.0)
> 
> What are the necessary changes I need to make so as to be able to
> recompile my code with the latest version of gcc.
> 

Well, I don't know all the difficulties you will encounter, but here are
  few I have come across:

Conversions such as:

  char* => char const*  
  signed char* => char* , unsigned char* => char* , etc
  signed T* => unsigned T* and its reverse

  are illegal in gcc 2.95.x . Earlier
  versions of gcc either generated warnings, or silently permitted them. 

I don't remember if 2.7.2 accepted k&r style function decls and defs in
  c++ mode, but g++ 2.95.2 definitely will not.

const foo=1;

  is now illegal; change it to 'const int foo;' .

I think there have also been some changes to declaring  friends of
  templated classes. I don't remember how to do it under 2.7.2, but 2.95.2
  accepts the following:

template<typename T> class A;

template<typename T> class B;

template<typename TT>
  class Foo
  {
  public:

    //A typical binary friend operator:
  friend bool operator==<>(Foo const& ,Foo const& );

    //Making *all* instances of template class A friends.
  template<typename X> friend class A;

    //Making *only* B<TT> a friend.
  friend class B<TT> ;
  };

See http://gcc.gnu.org/gcc-2.95/caveats.html for other possible
  difficulties.

You may be able to improve the design and or readablity of the old code
  due to the fact that 2.95.2 has much better support for many c++
  features, especially templates. See http://gcc.gnu.org/gcc-2.95/c++features.html
  for details. (Be aware that gcc 2.95.2 may be ahead of some older
  compilers you may need to keep supporting.)

If you have some code you *cannot* convert, try -fpermissive on it; this
  will make g++ accept lots of now obsolete constructs. I have friends who
  needed -fpermissive to make X apps written in C++ compile on Solaris
  (which has very old X headers appearently).

  reply	other threads:[~2000-02-07 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-07 20:35 Jayakrishnan J
2000-02-07 22:27 ` llewelly [this message]
2000-04-01  0:00   ` llewelly
2000-04-01  0:00 ` Jayakrishnan J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.10.10002072253500.11999-100000@198.dsl.xmission.com \
    --to=llewelly@198.dsl.xmission.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=j.jayakrishnan@sisl.co.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).