This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 216891 - Valid c function is not behaving how it should via the C99 standard.
Summary: Valid c function is not behaving how it should via the C99 standard.
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-15 04:09 UTC by 133794m3r
Modified: 2012-12-06 19:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 133794m3r 2012-08-15 04:09:30 UTC
Product Version = NetBeans IDE 7.1 (Build 201112071828)
Operating System = Linux version 3.2.0-0.bpo.2-amd64 running on amd64
Java; VM; Vendor = 1.7.0-internal
Runtime = OpenJDK 64-Bit Server VM 23.0-b21


As stated the C99 standard makes the following function _completely_ valid yet netbeans believes that it's not. Thus I am lead to believe that netbeans doesn't even support the c99 standard, thus it should be added to the list of things as I can imagine quite a few people require some of the new features in c99.

The function is below, I'm using the P99 header macros to do the variable argument bits, but it is completely valid, it compiles with gcc, and it works exactly how it says.

#define substring(...) P99_CALL_DEFARG(substring, 3, __VA_ARGS__)
#define substring_defarg_2() (-1)
char *substring(char *string, size_t start, size_t len) {
  size_t length = strlen(string);
  if(len == SIZE_MAX){
    len = length - start;
  }
  char *to_string = malloc(len + 1);
  memcpy(to_string, string+start, len);
  to_string[len] = '\0';
  return to_string;
}
Comment 1 Alexander Pepin 2012-09-11 09:53:22 UTC
QE: now it should be covered by c99 testbase