Abstrusi?! Oder programmier ich schon?

  • Abstrusi?! Oder programmier ich schon?

    Hey Leute, ich habe mit so ne kleine Grafische Oberflache gebaut wo ich drauf zeichnen kann. Da NSPoint nur ne Struktur ist habe ich mir ne schöne handliche Klasse dafür gemacht wo NSPoint eingebettet ist. nun habe ich da ua folgende F():

    Quellcode

    1. - (void)getPointInfo {
    2. int xx = thePoint.x;
    3. int yy = thePoint.y;
    4. NSLog(@"SPC--------aPoint: x=%d y=%d",thePoint.x,thePoint.y);
    5. }

    thePoint ist NSPoint und xx yy sind nur test Variablen zum Debuggen denn hier ist auch mein Prob. XY sind bereits zugewiesen und auch xx und yy werden Richtig zugewiesen nur bei NSLog kommt der totale Rummel aus :
    2006-04-27 18:19:00.584 canvas[8227] SPC--------aPoint: x=1081286656 y=0
    und das obwohl zB x=233 und y=243 ist. Was mach ich nur falsch????
    mfg
    d
  • RE: Abstrusi?! Oder programmier ich schon?

    das die variablen keine integer sondern floats sind ^^

    sprich in der NSLog muß min eine %f stehen

    und dein int xx = thePoint.x; ist eine implizierter cast von float auf int

    mal anfüg:

    Quellcode

    1. typedef struct _NSPoint {
    2. float x;
    3. float y;
    4. } NSPoint;
    snafu
    :() { :|: &};:
    sometimes i dream in hex
    Obey gravity! Because its a law!