- Does this program have the specified behavior? - 4 Updates
| Juha Nieminen <nospam@thanks.invalid>: Nov 18 06:32AM >>> return 1; >>> } > This code does compile and run correctly. It might compile as C, but it shouldn't compile as C++, because it's trying to call an int(*)() with a parameter, even though that function (that the pointer is pointing to does not take any parameter.) Perhaps if it were an int(*)(void*) and then you reinterpret-cast the parameter in order to call it, then it would compile. As for "runs correctly", I don't see how this "runs correctly". Unless you mean an infinite recursion that does nothing "runs correctly". |
| Ben Bacarisse <ben.usenet@bsb.me.uk>: Nov 18 11:15AM > It might compile as C, but it shouldn't compile as C++, because it's trying > to call an int(*)() with a parameter, even though that function (that the > pointer is pointing to does not take any parameter.) Just as it must not compile in C++, this code must compile in C. The meaning of empty ()s in a function declaration is different between the two languages. When I tidied up the code, I wrote C, not C++, because C has a more suitable type available. -- Ben. |
| olcott <NoOne@NoWhere.com>: Nov 18 08:58AM -0600 On 11/18/2021 12:32 AM, Juha Nieminen wrote: > parameter in order to call it, then it would compile. > As for "runs correctly", I don't see how this "runs correctly". Unless you > mean an infinite recursion that does nothing "runs correctly". This is the question that I am asking: Does this program have the specified behavior? For every H that simulates or executes its input and aborts or does not abort its input P never reaches its last instruction. -- Copyright 2021 Pete Olcott Talent hits a target no one else can hit; Genius hits a target no one else can see. Arthur Schopenhauer |
| olcott <NoOne@NoWhere.com>: Nov 18 08:59AM -0600 On 11/18/2021 5:15 AM, Ben Bacarisse wrote: > two languages. > When I tidied up the code, I wrote C, not C++, because C has a more > suitable type available. You did a really great job. -- Copyright 2021 Pete Olcott Talent hits a target no one else can hit; Genius hits a target no one else can see. Arthur Schopenhauer |
| You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment