Link to home
Start Free TrialLog in
Avatar of sjinaz
sjinaz

asked on

Porting C++ program from Alpha to Intel

I am trying to run a C++ program on an Intel machine that was previously being run on an Alpha machine.  I have gone through and added a new configuration as described in the MSDN library (Port Visual C++ Applications Between Intel-Based and RISC (Alpha or PowerPC)).  My problem is that having done this I now get errors and warnings when I compile the program that didn't exist when it was run on the Alpha.  Specifically, I get the following errors/warnings:

error C2709 'Identifier' : formal parameter's length in bytes differs from previous declaration
warning C4024 'function' : different types for formal and actual parameter 'number'
warning C4047 'identifier1' : 'operator' : different levels of indirection from 'identifier 2'

Why are these errors cropping up on the Intel platform and not on the Alpha?  Does anyone know how to fix these types of errors/warnings?

(Note:  I am very new to C++ and therefore need things explained as simply as possible)

Thanks.
Avatar of jkr
jkr
Flag of Germany image

Could you post some code?
Avatar of EOL
EOL

This seems to be a compiler issue. You should try to get the compiler you used with your alpha on intel. Or if possible, use gcc on your alpha and eleminite the errors there, then port it and use gcc for intel.

ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
uhyes. It's likely that you got a fair amount of legacy code that M$ was rendering uselss somwhere between the creation and the introduction of their new compiler/librarys.
I have to go from VAX/VMS and vice versa all the time while writing programs for school, please post some code.
Avatar of sjinaz

ASKER

Here is some sample code:

float a;
double b,c,d;
float e,f,g;
double h = 1.0;
double i,j;

abc(a, &b, &c, &d, &e, &f, &g, &h, &i, &j);

abc(float a, double *b, double *c, double *d, float *e, float *f, float *g, double *h, double *i, double *j)


This code ran without error on the Alpha but on the Intel machine I get the following error on the function header:

C2709 ('Identifier' : formal parameter's length in bytes differs from previous declaration)

Thanks
Have you tried sth. like

<rettype> abc(float a, double *b, double *c, double *d, float *e, float *f, float *g, double *h, double *i, double *j);

float a;
double b,c,d;
float e,f,g;
double h = 1.0;
double i,j;

abc(a, &b, &c, &d, &e, &f, &g, &h, &i, &j);

?

It seems that the compiler 'sees' a different declaration...
I think abc(a, &b, &c, &d, &e, &f, &g, &h, &i, &j);
is the problem. If you are calling a function with reference paramaters, you don't need to call the reference (&), just the variable. The only places the reference should go are the prototype and the definition.

// Prototype
int abc(int, int &, int &, int &, int &, int &, int &, int &, int &, int &);

// Call
abc(a, b, c, d, e, f, g, h, i, j);

// Definition
int abc(int a, int &b, int &c, int &d, int &e, int &f, int &g, int &h, int &i, int &j)
{
   insert code here;
}

Hope this helps.
This question didn't show any activity for more than 21 days. I will ask Community Support to close it unless you finalize it yourself within 7 days.
You can always request to keep this question open. But remember, experts can only help if you provide feedback to their comments.
Unless there is objection or further activity,  I will suggest to accept

    "jkr"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
========
Werner
Force accepted

** Mindphaser - Community Support Moderator **