* [Xenomai-core] Signature of kernel_init of xenomai-solo? @ 2008-09-19 18:47 Niklaus Giger 2008-09-20 21:12 ` Gilles Chanteperdrix 0 siblings, 1 reply; 3+ messages in thread From: Niklaus Giger @ 2008-09-19 18:47 UTC (permalink / raw) To: xenomai-core 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 -- NIklaus Giger ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] Signature of kernel_init of xenomai-solo? 2008-09-19 18:47 [Xenomai-core] Signature of kernel_init of xenomai-solo? Niklaus Giger @ 2008-09-20 21:12 ` Gilles Chanteperdrix 2008-09-22 17:50 ` Philippe Gerum 0 siblings, 1 reply; 3+ messages in thread From: Gilles Chanteperdrix @ 2008-09-20 21:12 UTC (permalink / raw) To: Niklaus Giger; +Cc: xenomai-core Niklaus Giger wrote: > 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. 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 ? -- Gilles. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] Signature of kernel_init of xenomai-solo? 2008-09-20 21:12 ` Gilles Chanteperdrix @ 2008-09-22 17:50 ` Philippe Gerum 0 siblings, 0 replies; 3+ messages in thread From: Philippe Gerum @ 2008-09-22 17:50 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai-core Gilles Chanteperdrix wrote: > Niklaus Giger wrote: >> 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. > > 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 ? > 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. -- Philippe. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-22 17:50 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-09-19 18:47 [Xenomai-core] Signature of kernel_init of xenomai-solo? Niklaus Giger 2008-09-20 21:12 ` Gilles Chanteperdrix 2008-09-22 17:50 ` Philippe Gerum
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.