Wrox Programmer Forums
|
BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2
This is the forum to discuss the Wrox book Programming Interviews Exposed: Secrets to Landing Your Next Job, 2nd Edition by John Mongan, Noah Suojanen, Eric Giguère; ISBN: 9780470121672
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK Programming Interviews Exposed: Secrets to Landing Your Next Job 2nd Ed ISBN: 978-0-470-12167-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2010, 09:53 PM
Registered User
 
Join Date: Mar 2010
Posts: 8
Thanks: 0
Thanked 8 Times in 8 Posts
Default new returns NULL or throws exception?

I am aware that in some compilers, you can set new to throw an out of memory exception, rather than returning NULL. I would think that your readers would find it somewhat confusing that from one page to the next, you change your mind which behavior you expect from the compiler.

On page 28, you rely on new to return NULL:

Code:
if (!newElem) return false;
On page 34, you state,

Quote:
An exception can be thrown when a memory allocation fails, which enables you to use the return value of pop for data instead of an error code.
And then you rely on that behavior in the push function listed on Page 35.

It might be nicer for the reader if you make a more overt statement about which behavior of new you expect, in any given example. Even better, state which version of new you expect as a general assumption at the beginning of the book, and then specifically highlight when you rely on a different assumption.

Regards,
Matt
The Following User Says Thank You to MattCruikshank For This Useful Post:
WayneHeym (May 27th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript getElementById returns null VictorVictor ASP.NET 2.0 Professional 15 January 15th, 2010 06:53 PM
Dropdownlist throws exception abhishekkashyap27 C# 2005 2 January 14th, 2008 03:05 PM
in chapter 32 class QuoteServer throws exception vit100 BOOK: Professional C#, 2nd and 3rd Editions 1 January 29th, 2006 06:31 PM
getRealPath returns null in Fedora bbhutta Servlets 0 October 21st, 2005 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.