Hi all, In experimenting with adding classes to ROOT, I think I stumbled on an inconvenience in the way rootcint works. I wanted to see how ROOT would work with user-defined abstract base classes, so I put together a seemingly trivial example using two classes, `base' and `derived'. The native SGI CC found errors in the dictionary file for these classes created by running `rootcint'. When I looked at the source, I found the following: /* Setting up class inheritance */ static long G__2vbo_derived_base_0(long pobject) { derived *derived=(derived*)pobject; base *base=derived; return((long)base-(long)derived); } Here's a dissection of that first variable declaration: derived *derived=(derived*)pobject; ^ ^ | | | name of local variable automatically generated by rootcint | name taken from the name of my class, `derived' The fact that the local variable (coincidentally) has the same name as my class, causes errors in compilation. If I change the name of my class to `derived1', the same lines in the output of `rootcint' look like: /* Setting up class inheritance */ static long G__2vbo_derived1_base1_0(long pobject) { derived1 *derived=(derived1*)pobject; base1 *base=derived; return((long)base-(long)derived); } And everything works just fine. We can certainly debate whether user classes named `derived' and `base' are a good idea or not, but since these functions above are automatically generated by `rootcint', and are not generally intended for human consumption, I'd suggest it pick names less likely to collide with user code - lots of underscores and the like. Just my 2 [cents,francs,yen]. Cheers, Dave -- David P. Morrison, Postdoctoral Research Associate University of Tennessee, 401 Nielsen Hall, Knoxville, TN 37996-1200 Oak Ridge National Laboratory, MS 6374, Oak Ridge, TN 37831-6374 Phone: (423) 576-8765, Fax: (423) 576-5780, Finger for public key
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET