Errors in TDPL

Jonathan M Davis jmdavisProg at gmail.com
Thu Jun 24 01:57:43 PDT 2010


Alix Pexton wrote:

> On 24/06/2010 09:09, Jonathan M Davis wrote:
>> Alix Pexton wrote:
>>
>>> Can someone sanity check me on the code on pages 334-5?
>>>
>>> Does the method push really need !empty in its in contract?
>>>
>>> I might not be fully awake yet><
>>>
>>> A...
>>
>> It has to be an error. If you couldn't push onto an empty stack, then
>> you'd never be able to put anything on the stack.
>>
>> - Jonathan M Davis
> 
> That's what I thought, but it's there in the example over the page as
> well, so I though maybe I was missing something ><
> 
> A...

I haven't look at it in detail yet, but it definitely looks like it's a 
copy-paste error, and it makes no sense for a push function to insist that 
something have already been pushed before you can push anything onto the 
stack.

- Jonathan M Davis


More information about the Digitalmars-d mailing list