public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiling legacy code
@ 2000-02-07 20:35 Jayakrishnan J
  2000-02-07 22:27 ` llewelly
  2000-04-01  0:00 ` Jayakrishnan J
  0 siblings, 2 replies; 4+ messages in thread
From: Jayakrishnan J @ 2000-02-07 20:35 UTC (permalink / raw)
  To: Gcc-Help (E-mail)

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.

regards,
Jay.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling legacy code
  2000-02-07 20:35 Compiling legacy code Jayakrishnan J
@ 2000-02-07 22:27 ` llewelly
  2000-04-01  0:00   ` llewelly
  2000-04-01  0:00 ` Jayakrishnan J
  1 sibling, 1 reply; 4+ messages in thread
From: llewelly @ 2000-02-07 22:27 UTC (permalink / raw)
  To: Jayakrishnan J; +Cc: Gcc-Help (E-mail)

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).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Compiling legacy code
  2000-02-07 20:35 Compiling legacy code Jayakrishnan J
  2000-02-07 22:27 ` llewelly
@ 2000-04-01  0:00 ` Jayakrishnan J
  1 sibling, 0 replies; 4+ messages in thread
From: Jayakrishnan J @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Gcc-Help (E-mail)

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.

regards,
Jay.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling legacy code
  2000-02-07 22:27 ` llewelly
@ 2000-04-01  0:00   ` llewelly
  0 siblings, 0 replies; 4+ messages in thread
From: llewelly @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Jayakrishnan J; +Cc: Gcc-Help (E-mail)

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).

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-07 20:35 Compiling legacy code Jayakrishnan J
2000-02-07 22:27 ` llewelly
2000-04-01  0:00   ` llewelly
2000-04-01  0:00 ` Jayakrishnan J

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).