Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: on goto

Reply
Thread Tools

Re: on goto

 
 
Ben Bacarisse
Guest
Posts: n/a
 
      05-12-2010
Lie Ryan <(E-Mail Removed)> writes:

> On 05/11/10 09:56, Ben Bacarisse wrote:
>> Seebs <(E-Mail Removed)> writes:
>>
>>> On 2010-05-10, Ben Bacarisse <(E-Mail Removed)> wrote:

>> <snip>
>>>> You can't assume that the data is contiguous or, to be a little more
>>>> general, that a single [] operation means the same as three of them.
>>>> This is, after all, C++ not C.
>>>
>>> In C++ it's at least conceivable that someone could come up with some
>>> exceptionally sneaky overloading of [] to make it viable.

>>
>> That's why I said "you can't assume...". It is conceivable but it is
>> not a sensible assumption for the poster[1] to make. The post was about
>> a re-write to simplify come code. If that involves a "sneaky
>> overloading of []" any argument about simplification is blown away.

>
> If it hides the complexity, then it could be argued that it's simpler,
> at least from the outside.


For the purposes of evaluating the complexity of a solution, you have to
look at all the code. If a re-definition of is [] involved, then
that is part of the solution and we never got to see it.

I said that the argument is blown away -- not necessarily the
conclusion. All code can be simplified to "find_solution_to_problem()"
(or some variation thereof) but that's not a sound argument.

> C/C++ hides the complexity of assembly, who
> would argue that?
>
> I think there are two separate definition of complexity:


Only two?

> - subjective complexity: how complex the source code looks like
> - objective complexity: how complex what the machine is actually doing


<snip>
--
Ben.
 
Reply With Quote
 
 
 
 
Lie Ryan
Guest
Posts: n/a
 
      05-12-2010
On 05/12/10 21:42, Ben Bacarisse wrote:
> Lie Ryan <(E-Mail Removed)> writes:
>
>> On 05/11/10 09:56, Ben Bacarisse wrote:
>>> Seebs <(E-Mail Removed)> writes:
>>>
>>>> On 2010-05-10, Ben Bacarisse <(E-Mail Removed)> wrote:
>>> <snip>
>>>>> You can't assume that the data is contiguous or, to be a little more
>>>>> general, that a single [] operation means the same as three of them.
>>>>> This is, after all, C++ not C.
>>>>
>>>> In C++ it's at least conceivable that someone could come up with some
>>>> exceptionally sneaky overloading of [] to make it viable.
>>>
>>> That's why I said "you can't assume...". It is conceivable but it is
>>> not a sensible assumption for the poster[1] to make. The post was about
>>> a re-write to simplify come code. If that involves a "sneaky
>>> overloading of []" any argument about simplification is blown away.

>>
>> If it hides the complexity, then it could be argued that it's simpler,
>> at least from the outside.

>
> For the purposes of evaluating the complexity of a solution, you have to
> look at all the code. If a re-definition of is [] involved, then
> that is part of the solution and we never got to see it.


That is objective complexity.

> I said that the argument is blown away -- not necessarily the
> conclusion. All code can be simplified to "find_solution_to_problem()"
> (or some variation thereof) but that's not a sound argument.


If that function exists, then at that specific level of viewpoint, the
specific problem is trivial. In subjective complexity, the current level
of viewpoint is all that matters; the fact that one of the function
being called is complex is considered irrelevant.

In short, if you break your code into many small, trivial functions, it
would generally score very good in terms of subjective complexity, even
though its objective complexity may actually be equal (or even slightly
higher) than when the code is all in one place.

>> C/C++ hides the complexity of assembly, who
>> would argue that?
>>
>> I think there are two separate definition of complexity:

>
> Only two?


correction: "at least two"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Goto statement ? Skybuck Flying VHDL 9 08-26-2005 01:46 PM
Re: VHDL Goto statement ? Skybuck Flying VHDL 0 08-08-2005 03:21 AM
where does Console.WriteLine() goto in a web app? Flip ASP .Net 1 04-14-2005 08:01 PM
where does Console.WriteLine() goto? Flip ASP .Net 6 11-18-2004 06:05 PM
goto statement is recommened in systemc? youngsun park VHDL 2 11-18-2003 03:47 PM



Advertisments