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


Groups > comp.lang.c > #122956

Re: Equal yet different pointers

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Equal yet different pointers
Date 2017-11-19 13:44 +1300
Message-ID <f7c2etFnms3U6@mid.individual.net> (permalink)
References (12 earlier) <dvMPB.145943$ej.73270@fx46.am4> <f79kjsFk4dnU13@mid.individual.net> <PJUPB.15517$Ts.11712@fx40.am4> <f7bsgiFnms3U3@mid.individual.net> <yi3QB.30699$GW.15184@fx19.am4>

Show all headers | View raw


On 11/19/2017 12:25 PM, bartc wrote:
> On 18/11/2017 23:02, Ian Collins wrote:
>> On 11/19/2017 12:23 AM, bartc wrote:
>>> On 18/11/2017 02:35, Ian Collins wrote:
>>>> On 11/18/2017 03:01 PM, bartc wrote:
>>>
>>>>> What do you mean?
>>>>
>>>> Don't use undefined behaviour.
>>>
>>> What 'undefined behaviour'? Oh, you mean all that stuff in the C
>>> standard; I guess that is not C 'getting in the way'?
>>
>> Would you generate {insert your language here} code in such a [way]as to
>> violate its standard?
> 
> I might use a source language that is designed to work on a limited set
> of targets where I know that certain operations will work without problems.

So why don't you?

> But if it has to pass through intermediate C, it can be a different
> story. The same operation may be undefined behaviour there, because C
> has to work on 1000 different platforms, and on 3 of the most obscure,
> the same operation is problematic.

But you aren't targeting those obscure platform, are you?  You, just 
like everyone else writing code for it can rely on the behaviours of 
your target platform.

> For that reason, it is undefined behaviour on all the other 997,
> including x86 and ARM families which are the only targets I have in mind.
> 
> For example, I often have to convert functions pointers to and from
> void*. But with enough warnings turned on, gcc tells me that ISO C
> forbids such conversions. You need to jump through a couple of hoops to
> get around that.
> 
> So what to do? Ignore the problem (usually gcc says nothing), and it
> might decide, if something is UB, to do something weird.
> 
> It's suddenly a problem where there wasn't one before.

If you are paranoid, use another level of indirection (void**).  If you 
know it will work on your target platform, there's nothing to worry about.

>>> badly aligned so generated byte-at-a-time code or something; the result
>>> anyway was that everything ran 3 times slower than it should.
>>
>> So you hit a compiler bug and therefore the language is at fault?  I see.
> 
> Was it a compiler bug? As the program otherwise worked. Whatever the
> problem was, the solution required a workaround, some additional effort.

More specifically, a code generation bug then.

> I know you're trying hard to make out the problem is always going to be
> somewhere else than in C, because it is perfect, but why not admit that,
> yes, a strong language like C with with a mind of its own and C
> compilers also with minds of their own CAN get in the way of what
> someone is trying to do.

I'm doing nothing of the sort.  No one here claims C is perfect, no 
programming language is.  If you keep putting up hypothetical arguments 
(of bugs) to justify your claims, people will keep shooting them down.

If you know your language, platforms and tools you will be able to uses 
them as needed.  if you don't, you shouldn't be programming.

-- 
Ian.

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


Thread

Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 11:29 +0100
  Re: Equal yet different pointers Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2017-11-16 03:01 -0800
    Re: Equal yet different pointers "Bill Davy" <Bill@XchelSys.co.uk> - 2017-11-16 11:03 +0000
    Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 13:55 +0100
      Re: Equal yet different pointers Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2017-11-16 06:44 -0800
        Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-16 14:49 +0000
          Re: Equal yet different pointers Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2017-11-16 08:28 -0800
        Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 16:46 +0100
      Re: Equal yet different pointers "James R. Kuyper" <jameskuyper@verizon.net> - 2017-11-16 12:29 -0500
        Re: Equal yet different pointers Nick Bowler <nbowler@draconx.ca> - 2017-11-17 22:47 +0000
          Re: Equal yet different pointers Richard Damon <Richard@Damon-Family.org> - 2017-11-18 17:03 -0500
  Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-16 11:09 +0000
    Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-16 11:14 +0000
    Re: Equal yet different pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-11-16 03:41 -0800
      Rick's neuroses (Was: Equal yet different pointers) gazelle@shell.xmission.com (Kenny McCormack) - 2017-11-16 12:11 +0000
        Re: Rick's neuroses (Was: Equal yet different pointers) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-11-16 04:30 -0800
          Re: Rick's neuroses (Was: Equal yet different pointers) David Brown <david.brown@hesbynett.no> - 2017-11-16 14:52 +0100
            Obscure references (Was: Rick's neuroses (Was: Equal yet different pointers)) gazelle@shell.xmission.com (Kenny McCormack) - 2017-11-19 12:32 +0000
              Re: Obscure references Noob <root@127.0.0.1> - 2017-11-20 11:08 +0100
                Re: Obscure references David Brown <david.brown@hesbynett.no> - 2017-11-20 12:36 +0100
    Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 14:45 +0100
      Re: Equal yet different pointers Keith Thompson <kst-u@mib.org> - 2017-11-16 08:55 -0800
        Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-16 17:09 +0000
          Re: Equal yet different pointers Keith Thompson <kst-u@mib.org> - 2017-11-16 09:33 -0800
        Re: Equal yet different pointers Gareth Owen <gwowen@gmail.com> - 2017-11-16 19:20 +0000
          Re: Equal yet different pointers Keith Thompson <kst-u@mib.org> - 2017-11-16 11:36 -0800
            Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 22:50 +0100
              Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-16 14:34 -0800
                Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-17 10:44 +0100
                Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-17 08:23 -0800
                Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-17 19:13 +0100
                Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-17 16:45 -0800
                Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-18 07:30 +0000
        Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 22:25 +0100
          Re: Equal yet different pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-16 23:11 +0000
            Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-16 15:47 -0800
            Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-17 10:49 +0100
      Re: Equal yet different pointers Gareth Owen <gwowen@gmail.com> - 2017-11-16 19:20 +0000
        Re: Equal yet different pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-11-16 11:26 -0800
        Re: Equal yet different pointers gazelle@shell.xmission.com (Kenny McCormack) - 2017-11-16 22:22 +0000
          Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-16 23:09 +0000
            Re: Equal yet different pointers gazelle@shell.xmission.com (Kenny McCormack) - 2017-11-17 08:50 +0000
              Re: Equal yet different pointers Gareth Owen <gwowen@gmail.com> - 2017-11-17 17:42 +0000
                Re: Equal yet different pointers gazelle@shell.xmission.com (Kenny McCormack) - 2017-11-17 19:35 +0000
      Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-16 23:34 +0000
        Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-16 15:58 -0800
        Re: Equal yet different pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-17 00:57 +0000
        Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-17 12:32 +0100
          Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-17 12:31 +0000
            Re: Equal yet different pointers mark.bluemel@gmail.com - 2017-11-17 07:23 -0800
            Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-17 17:14 +0100
              Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-18 00:12 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-18 13:39 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-18 01:39 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-18 14:42 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-18 02:01 +0000
                Re: Equal yet different pointers Melzzzzz <Melzzzzz@zzzzz.com> - 2017-11-18 02:07 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-18 15:35 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-18 11:23 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-19 12:02 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-18 23:25 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-19 13:44 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-19 01:05 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-19 14:30 +1300
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-19 01:48 +0000
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-19 16:21 +1300
                Re: Equal yet different pointers Reinhardt Behm <rbehm@hushmail.com> - 2017-11-19 11:44 +0800
                Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-19 10:10 +0000
                Re: Equal yet different pointers mark.bluemel@gmail.com - 2017-11-20 00:52 -0800
                Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-19 23:27 +0100
                Re: Equal yet different pointers Richard Damon <Richard@Damon-Family.org> - 2017-11-19 22:48 -0500
                Re: Equal yet different pointers Ian Collins <ian-news@hotmail.com> - 2017-11-20 16:52 +1300
    Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-16 14:28 +0000
      Re: Equal yet different pointers Barry Schwarz <schwarzb@dqel.com> - 2017-11-16 07:10 -0800
        Re: Equal yet different pointers David Brown <david.brown@hesbynett.no> - 2017-11-16 16:51 +0100
          Re: Equal yet different pointers "James R. Kuyper" <jameskuyper@verizon.net> - 2017-11-16 12:57 -0500
      Re: Equal yet different pointers supercat@casperkitty.com - 2017-11-16 08:03 -0800
      Re: Equal yet different pointers "James R. Kuyper" <jameskuyper@verizon.net> - 2017-11-16 12:38 -0500
        Re: Equal yet different pointers "Pascal J. Bourguignon" <pjb@informatimago.com> - 2017-11-16 20:13 +0100
          Re: Equal yet different pointers "James R. Kuyper" <jameskuyper@verizon.net> - 2017-11-16 14:29 -0500
    Re: Equal yet different pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-11-16 15:57 +0000
      Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-16 16:07 +0000
        Re: Equal yet different pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-11-16 19:01 +0000
          Re: Equal yet different pointers Spiros Bousbouras <spibou@gmail.com> - 2017-11-16 19:14 +0000
            Re: Equal yet different pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-11-16 19:47 +0000
      Re: Equal yet different pointers bartc <bc@freeuk.com> - 2017-11-16 23:08 +0000
        Re: Equal yet different pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-17 00:33 +0000

csiph-web