The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Compiler Bug / Limitation V7E

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ak vogel Posted - 09/09/2003 : 04:44:40 AM
The OriginC compiler generates an error ("function call and declaration mismatch") if you call a function with more than 30 parameters. The sample code below won't compile if you uncomment the function arguments from e1 onwards.

Aditionally, I noticed a bug in the Code Builder S&R feature: for example , try replacing "," with "1," and press "Replace all". You will get an endless loop replacing all "," signs again and again -> kill process.


//***sample code start***
void myTestFunc(double a,double b,double c,double d,double e,
double f,double g,double h,double i,double j,double k,
double l,double m,double n,double o,double p,double q,
double r,double s,double t,double u,double v,double w,
double x,double y,double z,double a1,double b1,double c1,
double d1/*,double e1,double f1,double g1,double h1,
double i1,double j1,double k1,double l1,double m1,
double n1,double o1,double p1,double q1,double r1,
double s1,double t1,double u1,double v1,double w1,
double x1,double y1,double z1*/)
{
return;
}


void test()
{

double a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
double a1,b1,c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,n1,o1,p1,q1,r1;
double s1,t1,u1,v1,w1,x1,y1,z1;


myTestFunc(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,
r,s,t,u,v,w,x,y,z,a1,b1,c1,d1/*,e1,f1,g1,h1,i1,
j1,k1,l1,m1,n1,o1,p1,q1,r1,s1,t1,u1,v1,w1,x1,y1,z1*/);
}
//***end of sample code***
3   L A T E S T    R E P L I E S    (Newest First)
hajo_old Posted - 10/23/2003 : 1:49:27 PM
Hello, ak vogel

what do you think about defining a structure, filling it with all the values you need, passing it to the function and extract it again within the function?

struct struct_parm{
int i1,
int i2,
...};

struct_parm.i1 = 10;
struct_parm.i2 = 20;
...

function(struct_parm& s)
{
NAG_FUNCTION(s.i1, s.i2, ...);
}

Hope that shows a way ...
Regards
Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
Siemens VDO, Regensburg

SVDO_Origin1

Edited by - SVDO_Origin1 on 10/24/2003 02:49:41 AM
ak vogel Posted - 09/22/2003 : 07:22:46 AM
The point is: a custom nlsf fit function can have up to 200 parameters + independent variables (don't know how many). This generates an OriginC function with *more* than 30 parameters.

I noticed the compiler limit when trying to call such a function directly for debugging purposes, which didn't work (it obviously does work when it's called from within the NLSF module).

What for do I need this? Unfortunately, the NLSF fit functions do *not* pass the parameters as an array, so I have to sort them into one by myself to be able to handle them. The only way I found is this:

- a C function with arbitrary number of parameters
-> stdarg.h, void foo(int count, double a, ... );
- implement this via external DLL, because of no strarg-support in OriginC
- write a preprocessor macro to #define a list of parameter names
- use this #define to call foo

It works, until it hits the limit of 30. My workaround: split the parameter list and call foo n times.

I know this is quite weird, and I might be the only person who is concerned - but believe me, it really s***s!
greg Posted - 09/12/2003 : 12:20:05 PM
The current limit is 30. This is hard-coded, and of course it can be expanded, but my question is (to everyone who reads this and cares to respond):
Is this really needed?
What number should it be? (Posters with 'infinite', please send sample function protoype.)

Note that you can pass a structure or array which will very nicely do what you are trying to do, so I don't see the reason for passing more than five or six arguments. But that's just me.



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000