In message <[EMAIL PROTECTED]>, John Labenski <[EMAIL PROTECTED]> writes >On 6/12/07, Alec Ross <[EMAIL PROTECTED]> wrote: >> In message >> <[EMAIL PROTECTED]>, John >> Labenski <[EMAIL PROTECTED]> writes >> >On 6/12/07, Alec Ross <[EMAIL PROTECTED]> wrote: >> >> In message <[EMAIL PROTECTED]>, >> >> John Labenski <[EMAIL PROTECTED]> writes >> >> ... >> >> > >> >> >2) To avoid any potential function name conflicts since C/C++ cannot >> >> >have functions start with '_', >> >> Library functions might. No issues w/ this? >> > >> >I don't know what you mean? The binding __index metatable function for >> >a userdata class checks for a leading '_' on a function call, flags >> >that the user wants the baseclass function, removes the '_' and then >> >checks the binding class struct for a C++ function with that name. >> >So... it's really only checking C++ functions which can never start >> >with a '_' anyway. >> > >> The C++ standard, in 17.4.3.1.2, reserves names beginning with an >> underscore for implementer use in the global namespace. (As well as >> explicitly listing names beginning with a double underscore, or an >> underscore followed by an uppercase letter.) And indeed this is not at >> all uncommon. So my question was simply about a possible clash between >> a wxLua use of a leading underscore and use in C++ library >> implementations. > >I didn't know this, but after a quick check it looks like a leading >underscore (or two in some cases) is only allowed disallowed (?) >for global functions >and reserved words/functions for the compiler. I couldn't find a >completely unambiguous (at least to me) description of it, but it does >look like class member functions still cannot have a leading >underscore? I think that they could; but probably best to avoid all leading underscores in user chosen identifiers.
> >If this is right then we're ok since we simply won't bother checking >when people overwrite global functions, in lua you'll just have to >name your function something else, which is fine. > Good. And of course any "overwriting" would violate the One Definition Rule (ODR). So folks should just not do this. >If I'm wrong or you can think of something that'll work even better >let me know so we won't have to change it later. > Sorry, no other suggestions atm. >Thanks, > John Labenski > ... Best Regards, Alec -- Alec Ross ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ wxlua-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wxlua-users
