strange behaviour of GSPrintf

"Sebastian Reitenbach" <[email protected]>
Newsgroups gmane.comp.lib.gnustep.user
Organization RapidEye AG
Message-ID <[email protected]>
Hi,

I observed that when I compile the piece of code at the end
gmake debug=yes

then I get the following output:

$ obj/ArrayTest
2006-09-17 21:34:54.322 ArrayTest[31262] Msg3
2006-09-17 21:34:54.323 ArrayTest[31262] Msg4
Msg2$

when I change the line 
  GSPrintf(stdout, @"%@", [outArray objectAtIndex: 1]);
to 
  GSPrintf(stdout, @"%@\n", [outArray objectAtIndex: 1]);

I get the following output:

$ obj/ArrayTest
Msg2
2006-09-17 21:36:38.694 ArrayTest[28187] Msg3
2006-09-17 21:36:38.695 ArrayTest[28187] Msg4
$                                                

is that explainable somehow? I compiled the sources from svn with gcc 3.3.5 
and ffcall 1.9 on an actual OpenBSD snapshot.

kind regards
Sebastian




#include "Foundation/Foundation.h"

int main(void)
{
  NSArray               *outArray;
  NSAutoreleasePool     *pool;

  pool = [NSAutoreleasePool new];
  outArray = [NSArray arrayWithObjects: @"Msg1", @"Msg2", @"Msg3", @"Msg4", 
nil];

//  printf("%s\n", (char *) [outArray objectAtIndex: 0]);

  GSPrintf(stdout, @"%@", [outArray objectAtIndex: 1]);

  NSLog(@"%@", [outArray objectAtIndex: 2]);

#ifdef DEBUG
  NSLog(@"%@", [outArray objectAtIndex: 3]);
#endif

  RELEASE(pool);
  return EXIT_SUCCESS;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.