Loading ...
Sorry, an error occurred while loading the content.

Can someone with Tiger test this program?

Expand Messages
  • Nico Weber
    Hi, can someone with Tiger execute the following program and send the output to me? //begin main.m #import static NSInteger CompareFunc(id a,
    Message 1 of 7 , Mar 1, 2008
    • 0 Attachment
      Hi,

      can someone with Tiger execute the following program and send the
      output to me?

      //begin main.m
      #import <Cocoa/Cocoa.h>

      static NSInteger CompareFunc(id a, id b, void *ignored) {
      return [a compare: b options: NSNumericSearch];
      }

      int main(int argc, char *argv[])
      {
      NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
      NSString *strings[] = {
      @"1",
      @"1.2",
      @"1.5",
      @"1.41",
      @"1.11",
      @"10.2.1",
      @"10.5.11",
      @"10.4.3"
      };


      NSArray *stringArray = [NSArray arrayWithObjects: strings
      count: sizeof
      strings / sizeof *strings];

      NSArray *sortedArray = [stringArray sortedArrayUsingFunction:
      CompareFunc context: NULL];

      NSLog(@"Before:\n%@", stringArray);
      NSLog(@"After:\n%@", sortedArray);
      [localPool release];
      return 0;
      }

      //end main.m

      To do this, you need to have the Developer Tools. If they are
      installed on your mac, open Terminal.app and enter the following three
      commands:

      pbpaste > test.m
      gcc -framework Foundation test.m
      ./a.out

      Then copy the output and send it back. Thanks :-)

      Nico

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • björn
      ... Here you go: $ gcc -framework Foundation main.m $ ./a.out 2008-03-01 19:32:15.780 a.out[2007] Before: (1, 1.2 , 1.5 , 1.41 , 1.11 , 10.2.1 ,
      Message 2 of 7 , Mar 1, 2008
      • 0 Attachment
        On 01/03/2008, Nico Weber <nicolasweber@...> wrote:
        >
        > Hi,
        >
        > can someone with Tiger execute the following program and send the
        > output to me?
        >
        > //begin main.m
        > #import <Cocoa/Cocoa.h>
        >
        > static NSInteger CompareFunc(id a, id b, void *ignored) {
        > return [a compare: b options: NSNumericSearch];
        > }
        >
        > int main(int argc, char *argv[])
        > {
        > NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
        > NSString *strings[] = {
        > @"1",
        > @"1.2",
        > @"1.5",
        > @"1.41",
        > @"1.11",
        > @"10.2.1",
        > @"10.5.11",
        > @"10.4.3"
        > };
        >
        >
        > NSArray *stringArray = [NSArray arrayWithObjects: strings
        > count: sizeof
        > strings / sizeof *strings];
        >
        > NSArray *sortedArray = [stringArray sortedArrayUsingFunction:
        > CompareFunc context: NULL];
        >
        > NSLog(@"Before:\n%@", stringArray);
        > NSLog(@"After:\n%@", sortedArray);
        > [localPool release];
        > return 0;
        > }
        >
        > //end main.m
        >
        > To do this, you need to have the Developer Tools. If they are
        > installed on your mac, open Terminal.app and enter the following three
        > commands:
        >
        > pbpaste > test.m
        > gcc -framework Foundation test.m
        > ./a.out
        >
        > Then copy the output and send it back. Thanks :-)

        Here you go:
        $ gcc -framework Foundation main.m
        $ ./a.out
        2008-03-01 19:32:15.780 a.out[2007] Before:
        (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
        2008-03-01 19:32:15.782 a.out[2007] After:
        (1, "1.11", "1.2", "1.41", "1.5", "10.2.1", "10.4.3", "10.5.11")

        By the way: "NSInteger" was introduced with Leopard...I had to change
        it to "int".


        /Björn

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Brian Wolven
        ... Ah - that explains why I got this: $ gcc -framework Foundation test.m test.m:4: error: parse error before CompareFunc Works now, but... I get a different
        Message 3 of 7 , Mar 1, 2008
        • 0 Attachment
          On Mar 1, 1:33 pm, "björn" <bjorn.winck...@...> wrote:

          > Here you go:
          > $ gcc -framework Foundation main.m
          > $ ./a.out
          > 2008-03-01 19:32:15.780 a.out[2007] Before:
          > (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
          > 2008-03-01 19:32:15.782 a.out[2007] After:
          > (1, "1.11", "1.2", "1.41", "1.5", "10.2.1", "10.4.3", "10.5.11")
          >
          > By the way: "NSInteger" was introduced with Leopard...I had to change
          > it to "int".

          Ah - that explains why I got this:

          $ gcc -framework Foundation test.m
          test.m:4: error: parse error before 'CompareFunc'

          Works now, but... I get a different order for the sortedArray:

          2008-03-01 13:38:18.969 a.out[17692] Before:
          (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
          2008-03-01 13:38:18.969 a.out[17692] After:
          (1, "1.2", "1.5", "1.11", "1.41", "10.2.1", "10.4.3", "10.5.11")
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Nico Weber
          ... That s the order I wanted to have. Which version of Tiger are you using? Bjorn, which version are you using? Oh well, as long as the version number after
          Message 4 of 7 , Mar 1, 2008
          • 0 Attachment
            > Works now, but... I get a different order for the sortedArray:
            >
            > 2008-03-01 13:38:18.969 a.out[17692] Before:
            > (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
            > 2008-03-01 13:38:18.969 a.out[17692] After:
            > (1, "1.2", "1.5", "1.11", "1.41", "10.2.1", "10.4.3", "10.5.11")

            That's the order I wanted to have. Which version of Tiger are you
            using? Bjorn, which version are you using? Oh well, as long as the
            version number after the dot has just one digit, we're fine :-\

            Nico


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • björn
            ... I m using 10.4.11 PPC here. /Björn --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac maillist. For more
            Message 5 of 7 , Mar 1, 2008
            • 0 Attachment
              On 01/03/2008, Nico Weber <nicolasweber@...> wrote:
              >
              > > Works now, but... I get a different order for the sortedArray:
              > >
              > > 2008-03-01 13:38:18.969 a.out[17692] Before:
              > > (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
              > > 2008-03-01 13:38:18.969 a.out[17692] After:
              > > (1, "1.2", "1.5", "1.11", "1.41", "10.2.1", "10.4.3", "10.5.11")
              >
              >
              > That's the order I wanted to have. Which version of Tiger are you
              > using? Bjorn, which version are you using? Oh well, as long as the
              > version number after the dot has just one digit, we're fine :-\

              I'm using 10.4.11 PPC here.

              /Björn

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_mac" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Brian Wolven
              ... 10.4.11 Intel here. --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_mac maillist. For more information,
              Message 6 of 7 , Mar 1, 2008
              • 0 Attachment
                On Mar 1, 4:32 pm, "björn" <bjorn.winck...@...> wrote:
                > On 01/03/2008, Nico Weber <nicolaswe...@...> wrote:
                >
                > > > Works now, but... I get a different order for the sortedArray:
                >
                > > > 2008-03-01 13:38:18.969 a.out[17692] Before:
                > > > (1, "1.2", "1.5", "1.41", "1.11", "10.2.1", "10.5.11", "10.4.3")
                > > > 2008-03-01 13:38:18.969 a.out[17692] After:
                > > > (1, "1.2", "1.5", "1.11", "1.41", "10.2.1", "10.4.3", "10.5.11")
                >
                > > That's the order I wanted to have. Which version of Tiger are you
                > > using? Bjorn, which version are you using? Oh well, as long as the
                > > version number after the dot has just one digit, we're fine :-\
                >
                > I'm using 10.4.11 PPC here.

                10.4.11 Intel here.
                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_mac" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • nicolasweber@gmx.de
                Works as expected on 10.5.2 PPC as well: 2008-03-01 22:56:52.125 a.out[2891:10b] Before: ( 1, 1.2 , 1.5 , 1.41 , 1.11 , 10.2.1 , 10.5.11 , 10.4.3 )
                Message 7 of 7 , Mar 1, 2008
                • 0 Attachment
                  Works as expected on 10.5.2 PPC as well:

                  2008-03-01 22:56:52.125 a.out[2891:10b] Before:
                  (
                  1,
                  "1.2",
                  "1.5",
                  "1.41",
                  "1.11",
                  "10.2.1",
                  "10.5.11",
                  "10.4.3"
                  )
                  2008-03-01 22:56:52.195 a.out[2891:10b] After:
                  (
                  1,
                  "1.2",
                  "1.5",
                  "1.11",
                  "1.41",
                  "10.2.1",
                  "10.4.3",
                  "10.5.11"
                  )

                  So this is only broken on Tiger PPC :-\
                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_mac" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.