Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mac > BOOK: Beginning Mac OS X Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
  #2 (permalink)  
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
  #3 (permalink)  
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".

  #4 (permalink)  
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.