Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c Subject: Re: Toy code for currency handling Date: Fri, 26 Jan 2018 07:30:22 +1300 Lines: 54 Message-ID: References: <92115d86-d5df-4cf5-afe6-37379ec575d1@googlegroups.com> <338154ad-7743-4673-8e1c-b644c1cc4cbb@googlegroups.com> <3f4603c1-8d53-4b06-9221-c0fb22be4b6c@googlegroups.com> <18b92e29-acae-4e1f-abfd-9766a2f65c5f@googlegroups.com> <52aaC.67316$rF4.82@fx04.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ATVt3WvfwLmgaDUAMcbFNw+nLnWv4m+ZzmTgh9dQWTkP5qD16y Cancel-Lock: sha1:bnDWg9u9rV/2WBNsxzy3m3dlsiI= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.c:125786 On 01/26/2018 07:16 AM, bartc wrote: > On 25/01/2018 18:05, Scott Lurndal wrote: >> bartc writes: > >>> How many identifiers in your programs use more than 31 characters? >>> >> $ typeset -i _max=0 >> $ for i in $(nm bin/asim | cut -f3 -d' ') >>> do >>> if (( ${#i} > _max )); >>> then >>> _max=${#i}; _line="${i}" >>> fi >>> done >> $ echo ${_max} >> 265 >> $ echo ${_line} >> _ZNSt3tr110_HashtableImSt4pairIKmN2bb12c_basicblock6item_tEESaIS6_ESt10_Select1stIS6_ESt8equal_toImENS_4hashImEENS_8__detail18_Mod_range_hashingENSE_20_Default_ranged_hashENSE_20_Prime_rehash_policyELb0ELb0ELb1EE21_M_deallocate_bucketsEPPNSE_10_Hash_nodeIS6_Lb0EEEm >> >> Which is expanded by c++filt to: >> >> std::tr1::_Hashtable, std::allocator >, std::_Select1st >, std::equal_to, std::tr1::hash, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::_M_deallocate_buckets(std::tr1::__detail::_Hash_node, false>**, unsigned long) >> >> Out of 194723 symbols in the symbol table, 47251 are greater than 31 characters in length. >> >> >> Now, granted this is C++, but it uses the same linker as C. > > Which is just abuse of the use of a 'name'. As I went to hint at in my post. Why? > If C++ needs to effectively store compressed source code within object > files, then create a linker format that will allow just that. And let > identifiers be used as identifiers. What compressed source code? A mangled name is just that, a name. > It's surprising that C++ can grow to be one of the biggest and most > complicated languages around, but it's not possible to tweak the linker > format to allow this extra information to be expressed properly. The linker is a separate tool. > BTW, is there any way of filtering out all these synthesised linker > names leaving just the ones used as actual identifiers in source code? They are mangled names, nothing to do with the linker. They are no different from any other. If you have a language that supports function and operator overloading, you need mangled names. -- Ian.