Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Mac OS X Programming
This is the forum to discuss the Wrox book Beginning Mac OS X Programming by Michael Trent, Drew McCormack; ISBN: 9780764573996
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Mac OS X Programming 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 September 8th, 2005, 12:52 PM
Authorized User
 
Join Date: Aug 2005
Location: La Charité-sur-Loire, , France.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3 : type changing

At the beginning, a and b are int. But finally, due to the use of pow (x, y) and in order to enhance the calculator, a and b become double. Just a little problem: why do they also become const ? They were not const at the beginning.

I have read the whole man pages of scanf, printf, and pow, and even looked at math.h, stdio.h and stdlib.h. I feel a little stupid and I really hope to get an explanation.

FJ
__________________
FJ
 
Old September 25th, 2005, 07:03 PM
Authorized User
 
Join Date: Aug 2005
Location: La Charité-sur-Loire, , France.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

At this time, I had 139 readers. But none answered my question. In spite of this, I tryed to obtain information, and from Paris Apple Expo's developers present I got this: if processor type is not specified, double is 32 bits aligned because it is 64 bits sized. The way to manipulate double without specify processor type is to manipulate it as const double.

I am not sure I have really well understood, so if anybody would confirm, I would be grateful!

FJ
 
Old November 1st, 2005, 05:42 PM
Wrox Author
 
Join Date: Nov 2005
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First, let me apologize for taking so long to reply

Second, the introduction of "const" in the solution for this exercise isn't a required part of the solution. Careful programmers use "const" in this context to tell the compiler these incoming values should not be modified. I probably added them as a reflex; they need not be const, and the example should probably just use "double a, double b".

 
Old November 14th, 2005, 10:02 PM
Authorized User
 
Join Date: Aug 2005
Location: La Charité-sur-Loire, , France.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mtrent
 First, let me apologize for taking so long to reply

I probably added them as a reflex; they need not be const, and the example should probably just use "double a, double b".

Really, thank you! The explanation obtained in Paris "Apple Expo" was not very satisfactory.

FJ




Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Data type samnachilomo SQL Server 2000 1 November 25th, 2006 03:25 PM
Changing Data Type Behaviour mat41 SQL Server ASP 8 August 28th, 2006 07:17 PM
changing the point type anukagni Access 2 July 29th, 2006 12:04 AM
Chapter 15 - Changing Type of Currency studentinpain BOOK: Beginning ASP 3.0 2 May 7th, 2005 04:53 PM
Changing data type JLN Pro VB 6 1 July 13th, 2004 12:49 PM





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