• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Typecasting in Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Typecasting in Cocoa?


  • Subject: Re: Typecasting in Cocoa?
  • From: Jim Correia <email@hidden>
  • Date: Fri, 28 Dec 2001 21:27:58 -0500

At 6:07 PM -0800 12/28/01, Alexander Dvorak wrote:

I am trying to do some calculations (Mandelbrot stuff)
in my program which require "double" accuracy and
would like to typecast an integer as a double. I
tried to typecast in the manner I know how (in C and
C++) and the compiler gave an error.

short x,y;
double zReal;

x = 5;
zReal = 3.6*(double(x));
// and also 3.6*(x(double)) and other variations

Can you typecast in Cocoa, and if so how?


Cocoa is a set of frameworks. The language is Objective-C. So the question is can you typecase in Objective-C. The answer is yes - the same way as in C.

(double)x

Neither of the syntax examples you give above are valid C or C++.

Jim


  • Follow-Ups:
    • Re: Typecasting in Cocoa?
      • From: Rosyna <email@hidden>
References: 
 >Typecasting in Cocoa? (From: Alexander Dvorak <email@hidden>)

  • Prev by Date: Typecasting in Cocoa?
  • Next by Date: Prevent screen saver to activate
  • Previous by thread: Typecasting in Cocoa?
  • Next by thread: Re: Typecasting in Cocoa?
  • Index(es):
    • Date
    • Thread