Signature of kernel_init of xenomai-solo?
Hi
Shouldn't the signature not bee
STATUS kernelInit(FUNCPTR rootRtn, int argc, const char * argv[]); instead of
STATUS kernelInit(FUNCPTR rootRtn, int argc, char *const argv[]); I think this would be more like a classical definition "main".
I have a classical definition of
int main(int argc, char *argv[])
which permits mit to pass it to , const char * argv[]), whereas char *const argv[] is not an allowd cast.
Best regards
Signature · 1 line
NIklaus Giger
Quoted 11 lines · Niklaus Giger
Hi
Shouldn't the signature not bee
STATUSkernelInit(FUNCPTR rootRtn, int argc, const char * argv[]); instead of
STATUSkernelInit(FUNCPTR rootRtn, int argc, char *const argv[]); I think this would be more like a classical definition "main".I have a classical definition of
intmain(int argc, char *argv[])
which permits mit to pass it to , const char * argv[]), whereas char *const argv[] is not an allowd cast.
Personnaly, I always used:
int main(int argc, const char *const argv[])
until the day when I started using getopt or getopt_long, which prototype are:
int getopt(int argc, char * const argv[],
const char *optstring);
int getopt_long(int argc, char * const argv[],
const char *optstring,
const struct option *longopts, int *longindex);
So, now, I always use:
int main(int argc, char *const argv[])
Maybe that is also the reason for the prototype of kernelInit ?
Signature · 1 line
Gilles.
Quoted 26 lines · Gilles Chanteperdrix
Quoted 11 lines · Niklaus Giger
Hi
Shouldn't the signature not bee
STATUSkernelInit(FUNCPTR rootRtn, int argc, const char * argv[]); instead of
STATUSkernelInit(FUNCPTR rootRtn, int argc, char *const argv[]); I think this would be more like a classical definition "main".I have a classical definition of
intmain(int argc, char *argv[])
which permits mit to pass it to , const char * argv[]), whereas char *const argv[] is not an allowd cast.Personnaly, I always used:
int
main(int argc, const char *const argv[])until the day when I started using getopt or
getopt_long, which prototype are:int getopt(int argc, char * const argv[],
const char *optstring);int getopt_long(int argc, char * const argv[],
const char *optstring,
const struct option *longopts, int *longindex);
Quoted 6 lines
So, now, I always use:
int
main(int argc, char *const argv[])Maybe that is also the reason for the prototype of kernelInit ?
Yes it is. Even if that looks a bit funky, we are still supposed to be able to poke to the arg memory, even if we can't change the pointers to it.
Signature · 1 line
Philippe.