Wrox Programmer Forums
|
BOOK: Beginning Visual C# 2005
This is the forum to discuss the Wrox book Beginning Visual C# 2005 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White; ISBN: 9780764578472
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2005 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 July 3rd, 2007, 01:09 PM
run run is offline
Registered User
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Operator Precedence p.66

On p.66 there is the following expression:
var1 = var2 <= 4 && var2 >= 2;

in the book it states "where the && operator is processed after the <= and >= operators"

isn't that just the case with the <= due to the conditional evaluation of operands with && ?

If the statement was correct, wouldn't the expression on p.60:
var1 = (var2 != 0) && (var3 / var2 > 2);
throw an exception if var2 is zero.


 
Old July 4th, 2007, 12:47 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 227
Thanks: 1
Thanked 7 Times in 7 Posts
Default

No, var2 would not throw the exception, but var3 definitely would, when var3 = 0.

Hope this helps.

========================
Disclaimer: The above comments are solely the opinion of one person and not to be construed as a directive or an incentive to commit fraudulent acts.
 
Old July 11th, 2007, 08:42 AM
run run is offline
Registered User
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why? there is nothing wrong with 0 divided by another number, but you can't divide with 0






Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about template precedence asc BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 3 December 1st, 2008 08:14 AM
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
select from 66 tables using checkboxes - how gilgalbiblewheel Classic ASP Databases 29 August 11th, 2004 12:31 AM





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