bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

base (mingw): [GSValue initWithBytes:objCType:]


From: Michael Scheibler
Subject: base (mingw): [GSValue initWithBytes:objCType:]
Date: Thu, 19 Apr 2001 14:50:11 +0200

When invoking GSValue initWithBytes: ... objCType: @encode(void) the program
aborts. Isn't it okay to do this?


- (id) initWithBytes: (const void *)value
     objCType: (const char *)type
{
  int size;

  if (!value || !type)
    {
      NSLog(@"Tried to create NSValue with NULL value or NULL type");
      RELEASE(self);
      return nil;
    }

  self = [super init];

  // FIXME: objc_sizeof_type will abort when it finds an invalid type, when
  // we really want to just raise an exception
  size = objc_sizeof_type(type);
  if (size <= 0)
    {
      NSLog(@"Tried to create NSValue with invalid Objective-C type");
      RELEASE(self);
      return nil;
    }


Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]