Porting C++ program from Alpha to Intel

sjinaz
sjinaz used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
jkr
Top Expert 2012

Commented:
Could you post some code?
EOL

Commented:
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.

Top Expert 2012
Commented:
>>This seems to be a compiler issue

It is more likely to be a MS Platform SDK issue (remember: "errors [...]on the Intel platform and not on the Alpha"). MS changed quite a bit since the last Alpha-compatible VC++ was released...
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

EOL

Commented:
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.

Author

Commented:
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
jkr
Top Expert 2012

Commented:
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.

Commented:
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 **

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial