D.gnu - An idea...
- Harvey (37/37) Nov 18 2004 Well two really.
Well two really.
First one, how's abouts being able to use the 'static' keyword for function
parameters, to denote that this parameter will not change on subsequent
calls to the function (from with itself only). This could be of use for
recursive functions where the (outside) caller needs to provide some info,
flag etc but once in the function it will retain the value upon further
internal calls (although just like other statics, this could get changed
internally).
recursiveFn(true);
int recursiveFn(static bit flag)
{
recursiveFn();
}
This could produce more optimal code than functions which pass such args
back into themselves even though they might never change. Admittedly the
calling of a function with a different arg set internally than externally is
a bit strange but I guess the same could be said of funcs that are
overloaded or have defaulted params.
Would this work? Is a complete rubbish? Does anyone give two hoots?
Also, how's abouts the following syntax for functions arguments:
void fn(int a,b,c; float d,e,f,g,h; char *i,*j; AClassThatHasQuiteALongName
k,l)
{
}
The current syntax being somewhat long winded:
void fn(int a,int b,int c,float d,float e,float f,float g,float h,char
*i,char *j,AClassThatHasQuiteALongName k,AClassThatHasQuiteALongName l)
{
}
Ok passing in so many args isn't generally such a good idea but you get the
point.
Mind you, to be consistent you'd want to do the same elsewhere, so for loops
could pose a problem:
for (int i=0,n=123; float c=3.1415; i<10; ++i)
{
}
Ah well, back to the drawing board...
Nov 18 2004








"Harvey" <hstroud ntlworld.com>