Operating System - HP-UX
1819899 Members
2456 Online
109607 Solutions
New Discussion юеВ

Compiling aCC code using CC

 
Vishal Augustine
Frequent Advisor

Compiling aCC code using CC

Hi,

As a part of aCC compiler migration, the code which we had were made aCC compliant. The same code we use in Solaris and we have to compile the code using CC. So the task of compiling an aCC code with CC. Eventhough the scenario mentioned here is that for Solaris, the whole idea is to compile the aCC code using CC and fool the compiler

Now the question.

1. Do we have an aCC compiler for Sun ? Is it a freeware ?

2. I thought of resolving the issue using some ifdef statements. e.g.

#ifdef __aCC
#include
#else
// Want help here. Want a wrapper for nothrow which
// will do nothing. Basically, the question is how to fool
// the compiler when it gets this statement ->
// int *i = new (nothrow) int[20];
#endif

If any one of you did something similar, can you please let me know

Thanks and Regard
Vishal
2 REPLIES 2
Vishal Augustine
Frequent Advisor

Re: Compiling aCC code using CC

Found out the way !!!!

Here it goes

---------------------------------------


#if defined(__YOUR_DEF) || defined(__sun)

const int nothrow = 0;

void * operator new(size_t _v_size, const int _v_dummy) throw() {
return (void *)(new char [size]);
}

#else

#include

#endif

---------------------------------------

Now you can
$ CC -D__YOUR_DEF file.cc

or in Solaris

$ CC file.cc


Thanks and Regards
Vishal
Vishal Augustine
Frequent Advisor

Re: Compiling aCC code using CC

Even

#define nothrow

will work in some compilers ;o)

Vishal