Re: Name lengths in C code
Dan -- Just a reminder--function names shouldn't exceed 31 characters. The C standard doesn't guarantee anything past that... Using this simplistic program I found two names greater than 31 chars. I don't know if there are names not fitting the little regexp used here, but of those that do, these: $ perl namecheck.pl *.c [35] PackFile_ConstTable_get_const_count [33] PackFile_ConstTable_push_constant are too long. So, who's the windbag that wrote such long names? Hey, waitaminute, I wrote those! The names are unique in the first 31 chars. Are we OK, or do I need to mangle the names? I could mangle them by doing one of the following: * PackFile_{SomeWords}_* PackFile_SW_* * PackFile_{SomeWords}_* PF_SW_* I'd rather mangle all the names in the library a standard way than have all but two written out fully and two not. Your thoughts? Regards, -- Gregor _ / perl -e 'srand(-2091643526); print chr rand 90 for (0..4)' \ Gregor N. Purdy [EMAIL PROTECTED] Focus Research, Inc.http://www.focusresearch.com/ 8080 Beckett Center Drive #203 513-860-3570 vox West Chester, OH 45069 513-860-3579 fax \_/ #!/usr/bin/perl -n # # namecheck.pl # # Check the names in C files # next unless m/^([A-Za-z][A-Za-z0-9_]*)\(/; printf [%2d] %s\n, length($1), $1 if length($1) 31;
Re: Name lengths in C code
At 13:16 on 09/21/2001 EDT, Uri Guttman [EMAIL PROTECTED] wrote: DS == Dan Sugalski [EMAIL PROTECTED] writes: DS At 09:37 AM 9/21/2001 -0400, Gregor N. Purdy wrote: The names are unique in the first 31 chars. Are we OK, or do I need to mangle the names? I could mangle them by doing one of the following: DS Try choosing something smaller. (If for no other reason than I DS don't want to have to type that long a name :) use a better editor. :) in emacs i wrote a copy word function and in my perl mode it also grabs the leading sigil. then i can paste it easily and not worry about spelling. For emacs users, meta-/ is even better. Type the first few letters of the function name, then hit meta-/. From the docs: Documentation: Expand previous word dynamically. Expands to the most recent, preceding word for which this is a prefix. If no suitable preceding word is found, words following point are considered. If still no suitable word is found, then look in the buffers accepted by the function pointed out by variable `dabbrev-friend-buffer-function'. A positive prefix argument, N, says to take the Nth backward *distinct* possibility. A negative argument says search forward. If the cursor has not moved from the end of the previous expansion and no argument is given, replace the previously-made expansion with the next possible expansion not yet tried. --Josh
Name lengths in C code
Just a reminder--function names shouldn't exceed 31 characters. The C standard doesn't guarantee anything past that... Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Name lengths in C code
On Thu, Sep 20, 2001 at 05:09:52PM -0400, Dan Sugalski wrote: Just a reminder--function names shouldn't exceed 31 characters. The C standard doesn't guarantee anything past that... You think that's bad? You aren't guaranteed more than six characters, case-insensitive for external identifiers. I've been told that Oracle actually requires conformance to this in their coding standards. I'm very happy that I don't have to write code for Orcale... - Damien