Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #125828

Re: Toy code for currency handling

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Toy code for currency handling
Date 2018-01-27 11:02 +1300
Message-ID <fd1mqpFk8pjU2@mid.individual.net> (permalink)
References (13 earlier) <WysaC.286909$Og3.232591@fx11.am4> <fd0205FkrsbU4@mid.individual.net> <rkEaC.710825$qb2.640585@fx25.am4> <fd1i6uFk8pjU1@mid.individual.net> <DiNaC.547340$yM6.495313@fx26.am4>

Show all headers | View raw


On 01/27/2018 10:44 AM, bartc wrote:
> On 26/01/2018 20:43, Ian Collins wrote:
>> On 01/27/2018 12:31 AM, bartc wrote:
>>> On 26/01/2018 07:00, Ian Collins wrote:
>>>> On 01/26/2018 11:08 AM, bartc wrote:
>>>>> On 25/01/2018 18:30, Ian Collins wrote:
>>>>>> On 01/26/2018 07:16 AM, bartc wrote:
>>>>>
>>>>>>> Which is just abuse of the use of a 'name'. As I went to hint at
>>>>>>> in my
>>>>>>> post.
>>>>>>
>>>>>> Why?
>>>>>
>>>>> If you were creating a data structure within program to the store the
>>>>> name, return type and parameter types of a function, would you
>>>>> choose to
>>>>> represent all that within one string?
>>>>
>>>> That's irrelevant.  Linkers read strings.
>>>
>>> They read object files and shared library files which are binary formats.
>>
>> The symbols are text.

No comment?

>>> A compiler can be a 100MB monster. A linker can be a 50KB utility,
>>> almost nothing because it's job is almost nothing.
>>>
>>> And because the linker is sourced separately from a compiler, it is
>>> IMPOSSIBLE to ever upgrade the specifications of a linker to match new
>>> developments in languages and compilers?
>>
>> How is what you are suggesting an upgrade?
>>
>> Mangled names are unique, can easily be converted to the original name
>> and are human readable.  They meet the requirement for a symbol name.
> 
> They are not human readable except insofar that they consist of
> printable characters.

Most (C++) mangled names are, it's those that include complex types that 
overwhelm.  Even those contain the original function name in plain text.

A more typical name form some of the code I'm working on is

_ZN2HW14CSocketCANPort16HandleWriteErrorEjRb

which even without using c++filt is clearly 
HW::CSocketCANPort::HandleWriteError and knowing the mangling scheme, 
the parameter types are clear.

> The example you gave is unacceptable.

I didn't give an example.

> It only makes sense for one
> language and one compiler. If I wanted to call that function from my
> language, I wouldn't have a clue how to refer to it.

It's a name, just call it!  If a C++ function is intended to be called 
from another language it will be declared with C linkage, so the symbol 
name will be a plain C function name.  If it isn't, it probably can't be 
called from another language.

> If it has to be done all within one string, there are better ways of
> partitioning it so that is is easily parsed by human or machine.

Such as?  Given my example above

HW::CSocketCANPort::HandleWriteError(unsigned int, bool&)

How would you uniquely encode it better than the current mangled name?

> What is surprising here is that when two C++ object files need to
> combine with each other, the preferred method is to:
> 
> * Take the name of each function
> 
> * Encode all the attributes of the function as a complicated string

How else would you do this without loosing information?

> * Wrap that string around the function to result in a new string that
> uniquely identifies the function

Eh?

> * Write it out as part of the symbol table of some third party object
> format that knows nothing about C++

The object format of the host platform.

> * Run a third party linker which also knows nothing about C++ and that
> this implementation knows nothing about either

Many smarter linker do. See https://en.wikipedia.org/wiki/Gold_(linker)

> * If that same set of attributes occur 1000 times in the file, than 1000
> copies of the mangled string are needed. (Does that suggest a better way
> of doing this stuff? In the binary formats I create, a elaborate
> resource is described once, then a simple index to it is used elsewhere.)

That's no different from any other symbol name.  You could write C with 
extremely long function names and the same argument would apply.  We 
live in 2018, tools aren't phased by long strings.

-- 
Ian.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Toy code for currency handling David Thompson <dave.thompson2@verizon.net> - 2018-01-21 11:53 -0500
  Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-21 11:44 -0800
    Re: Toy code for currency handling Keith Thompson <kst-u@mib.org> - 2018-01-21 12:24 -0800
      Re: Toy code for currency handling herrmannsfeldt@gmail.com - 2018-01-23 21:03 -0800
        Re: Toy code for currency handling Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-01-24 15:02 +0000
          Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-24 08:45 -0800
            Re: Toy code for currency handling Keith Thompson <kst-u@mib.org> - 2018-01-24 11:40 -0800
              Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-24 14:52 -0600
              Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-24 13:05 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-24 13:12 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 01:04 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-24 19:17 -0600
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-24 17:33 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 12:14 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 04:31 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 13:03 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 05:28 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 05:37 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 05:43 -0800
                Re: Toy code for currency handling mark.bluemel@gmail.com - 2018-01-25 05:57 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 15:48 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 08:32 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 10:56 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 21:28 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 15:10 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 06:14 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 06:38 -0800
                Re: Toy code for currency handling gordonb.ma9h0@burditt.org (Gordon Burditt) - 2018-01-24 21:53 -0600
                Re: Toy code for currency handling scott@slp53.sl.home (Scott Lurndal) - 2018-01-25 18:05 +0000
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 18:16 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-26 07:30 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-25 22:08 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-26 20:00 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-26 11:31 +0000
                Re: Toy code for currency handling scott@slp53.sl.home (Scott Lurndal) - 2018-01-26 15:51 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-26 10:32 -0600
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-26 08:50 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-26 13:11 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-26 18:32 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-26 13:07 -0600
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-27 09:43 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-26 21:44 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-27 11:02 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-27 00:46 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-28 09:19 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-27 21:19 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-27 14:14 -0800
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-28 11:21 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-27 22:32 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-28 12:16 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 00:44 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 04:13 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 13:56 +0000
                Re: Toy code for currency handling Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2018-01-28 06:12 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 06:43 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 15:40 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 07:56 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 16:12 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 08:34 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 16:53 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 09:30 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 09:48 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-28 23:23 -0600
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-29 18:29 +1300
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-28 23:45 -0600
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-29 19:54 +1300
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 01:38 -0600
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-29 20:56 +1300
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 20:34 -0600
                Re: Toy code for currency handling "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-01-29 21:46 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-28 23:34 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 12:02 +0000
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 12:33 +0000
                Re: Toy code for currency handling Richard Damon <Richard@Damon-Family.org> - 2018-01-29 08:30 -0500
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 14:08 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 19:36 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 11:49 +0000
                Re: Toy code for currency handling already5chosen@yahoo.com - 2018-01-30 04:45 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 13:04 +0000
                Re: Toy code for currency handling already5chosen@yahoo.com - 2018-01-30 05:17 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 14:23 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 11:39 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 18:23 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 18:25 -0600
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-31 07:56 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-31 12:56 -0600
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-31 13:09 -0800
                Re: Toy code for currency handling scott@slp53.sl.home (Scott Lurndal) - 2018-01-31 21:35 +0000
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-31 16:45 -0800
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-02-01 08:59 +0100
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-02-01 02:40 -0600
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-02-01 10:13 +0100
                Re: Toy code for currency handling scott@slp53.sl.home (Scott Lurndal) - 2018-02-01 14:49 +0000
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-02-01 16:13 +0100
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-02-01 09:05 -0800
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-02-01 22:07 +0100
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-02-01 15:49 -0800
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-02-02 13:13 +0100
                Re: Toy code for currency handling already5chosen@yahoo.com - 2018-01-30 05:30 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 10:48 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 12:59 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 20:26 -0600
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-29 20:36 -0600
                Re: Toy code for currency handling mark.bluemel@gmail.com - 2018-01-30 00:34 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 11:33 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 11:49 -0600
                Re: Toy code for currency handling jameskuyper@verizon.net - 2018-01-30 12:03 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 17:40 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-30 12:56 +0000
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-30 11:28 -0600
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-31 19:19 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 04:16 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 13:40 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 06:35 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 07:24 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-28 15:24 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-28 07:44 -0800
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-29 18:34 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 12:21 +0000
                Re: Toy code for currency handling Ian Collins <ian-news@hotmail.com> - 2018-01-30 07:59 +1300
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 19:56 +0000
                Re: Toy code for currency handling scott@slp53.sl.home (Scott Lurndal) - 2018-01-29 20:53 +0000
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-29 21:52 +0000
                Re: Toy code for currency handling Richard Damon <Richard@Damon-Family.org> - 2018-01-27 18:32 -0500
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-27 13:22 -0600
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 13:23 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 13:41 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 14:12 -0800
                Re: Toy code for currency handling bartc <bc@freeuk.com> - 2018-01-26 22:23 +0000
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 14:44 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 15:28 -0800
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-26 16:22 -0800
                Re: Toy code for currency handling David Brown <david.brown@hesbynett.no> - 2018-01-25 09:11 +0100
                Re: Toy code for currency handling fir <profesor.fir@gmail.com> - 2018-01-25 02:27 -0800
                Re: Toy code for currency handling Robert Wessel <robertwessel2@yahoo.com> - 2018-01-24 15:23 -0600
                Re: Toy code for currency handling Keith Thompson <kst-u@mib.org> - 2018-01-24 14:29 -0800
                Re: Toy code for currency handling supercat@casperkitty.com - 2018-01-24 14:49 -0800

csiph-web