Search Results

Search found 122 results on 5 pages for 'c99'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • MVS 2008 and C99

    - by yCalleecharan
    Hi, I read with interest the post "How universally is C99 supported ?". One of the comments therein points that Microsoft doesn't support C99. But the comment symbol // works with MVS 2008 and this symbol is in C99. I have two questions: To what extent MVS 2008 support C99? Is it ok in the same code to mix C89 and C99 syntax together? So if I write my code in C89 and then place a comment //. This means that I have mixed-coding. So what does the compiler do in such a case? Check my code first with c89 and then with C99 to accept that I use // for commenting? Thanks a lot...

    Read the article

  • How to use make and compile as C99?

    - by djTeller
    I'm trying to compile a linux kernel module using a Makefile: obj-m += main.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean Which gives me: main.c:54: warning: ISO C90 forbids mixed declarations and code I need to switch to C99. After reading I noticed I need to add a flag -std=c99, not sure where it suppose to be added. How do I change the Makefile so it will compile as C99?

    Read the article

  • Does C99 guarantee that arrays are contiguous ?

    - by kriss
    Following an hot comment thread in another question, I came to debate of what is and what is not defined in C99 standard about C arrays. Basically when I define a 2D array like int a[5][5], does the standard C99 garantee or not that it will be a contiguous block of ints, can I cast it to (int *)a and be sure I will have a valid 1D array of 25 ints. As I understand the standard the above property is implicit in the sizeof definition and in pointer arithmetic, but others seems to disagree and says casting to (int*) the above structure give an undefined behavior (even if they agree that all existing implementations actually allocate contiguous values). More specifically, if we think an implementation that would instrument arrays to check array boundaries for all dimensions and return some kind of error when accessing 1D array, or does not give correct access to elements above 1st row. Could such implementation be standard compilant ? And in this case what parts of the C99 standard are relevant.

    Read the article

  • getting "implicit declaration of function 'fcloseall' is invalid in C99" when compiling to gnu99

    - by Emanuel Ey
    Consider the following C code: #include <stdio.h> #include <stdlib.h> void fatal(const char* message){ /* Prints a message and terminates the program. Closes all open i/o streams before exiting. */ printf("%s\n", message); fcloseall(); exit(EXIT_FAILURE); } I'm using clang 2.8 to compile: clang -Wall -std=gnu99 -o <executable> <source.c> And get: implicit declaration of function 'fcloseall' is invalid in C99 Which is true, but i'm explicitly compiling to gnu99 [which should support fcloseall()], and not to c99. Although the code runs, I don like the have unresolved warnings when compiling. How can i solve this?

    Read the article

  • Free static checker for C99 code

    - by detly
    I am looking for a free static checker for C99 code (including GCC extensions) with the ability to explicitly say "these preprocessor macros are always defined." I need that last part because I am compiling embedded code for a single target processor. The compiler (Microchip's C32, GCC based) sets a macro based on the selected processor, which is then used in the PIC32 header files to select a processor-specific header file to include. cppcheck therefore fails because it detects the 30 different #ifdefs used to select one of the many possible PIC32 processors, tries to analyse all possible combinations of these plus all other #defines, and fails. For example, if splint could process C99 code, I would use splint -D__PIC32_FEATURE_SET__=460 -D__32MX460F512L__ \ -D__LANGUAGE_C__ -I/path/to/my/includes source.c

    Read the article

  • C99 and floating point environment

    - by yCalleecharan
    Hi, I was looking at new features of C99 and saw the floating point environment: #include <fenv.h> My question is simple. If I'm performing floating point number computations, do I have to include the above preprocessor directive in my code? If no, then what does this directive do and when does it become important to include? Thanks a lot...

    Read the article

  • double_t in C99

    - by yCalleecharan
    Hi, I just read that C99 has double_t which should be at least wide as double. Does this imply that it gives more precision digits after the decimal place? More than the usual 15 digits for double?. Secondly, how to use it: Is only including #include enough? I read that one has to set the FLT_EVAL_METHOD to 2 for long double. How to do this? As I work with numerical methods, I would like maximum precision without using an arbitrary precision library. Thanks a lot...

    Read the article

  • c99 goto past initialization

    - by R Samuel Klatchko
    While debugging a crash, I came across this issue in some code: int func() { char *p1 = malloc(...); if (p1 == NULL) goto err_exit; char *p2 = malloc(...); if (p2 == NULL) goto err_exit; ... err_exit: free(p2); free(p1); return -1; } The problem occurs when the first malloc fails. Because we jump across the initialization of p2, it contains random data and the call to free(p2) can crash. I would expect/hope that this would be treated the same way as in C++ where the compiler does not allow a goto to jump across an initialization. My question: is jumping across an initialization allowed by the standard or is this a bug in gcc's implementation of c99?

    Read the article

  • Efficiency of data structures in C99 (possibly affected by endianness)

    - by Ninefingers
    Hi All, I have a couple of questions that are all inter-related. Basically, in the algorithm I am implementing a word w is defined as four bytes, so it can be contained whole in a uint32_t. However, during the operation of the algorithm I often need to access the various parts of the word. Now, I can do this in two ways: uint32_t w = 0x11223344; uint8_t a = (w & 0xff000000) >> 24; uint8_t b = (w & 0x00ff0000) >> 16; uint8_t b = (w & 0x0000ff00) >> 8; uint8_t d = (w & 0x000000ff); However, part of me thinks that isn't particularly efficient. I thought a better way would be to use union representation like so: typedef union { struct { uint8_t d; uint8_t c; uint8_t b; uint8_t a; }; uint32_t n; } word32; Using this method I can assign word32 w = 0x11223344; then I can access the various parts as I require (w.a=11 in little endian). However, at this stage I come up against endianness issues, namely, in big endian systems my struct is defined incorrectly so I need to re-order the word prior to it being passed in. This I can do without too much difficulty. My question is, then, is the first part (various bitwise ands and shifts) efficient compared to the implementation using a union? Is there any difference between the two generally? Which way should I go on a modern, x86_64 processor? Is endianness just a red herring here? I could inspect the assembly output of course, but my knowledge of compilers is not brilliant. I would have thought a union would be more efficient as it would essentially convert to memory offsets, like so: mov eax, [r9+8] Would a compiler realise that is what happening in the bit-shift case above? If it matters, I'm using C99, specifically my compiler is clang (llvm). Thanks in advance.

    Read the article

  • What is the state of C99 support in major compilers / toolchains?

    - by pkh
    A response to a comment I made here made me stop and think: "I don't really know what the state of C99 support is." Wikipedia gives details for a few compilers, but I'm not familiar enough with C99 to know all the bits and pieces of the standard, so I'm looking for a gestalt overview answer to the question: What is the state of C99 support in major compilers / toolchains?

    Read the article

  • C99 mixed declarations and code in open source projects?

    - by Eduardo
    Why is still C99 mixed declarations and code not used in open source C projects like the Linux kernel or GNOME? I really like mixed declarations and code since it makes the code more readable and prevents hard to see bugs by restricting the scope of the variables to the narrowest possible. This is recommended by Google for C++. For example, Linux requires at least GCC 3.2 and GCC 3.1 has support for C99 mixed declarations and code

    Read the article

  • sscanf + c99 not working on some platforms ?

    - by Jane
    When I compile a simple Hello World! program that uses the sscanf function on my local Debian lenny x64, it works. But when I upload the same program to the server running CentOS x86, it will not work. If I do not use sscanf, then the program works on both computers. gcc -std=c99 -O2 -pipe -m32 If I compile it with sscanf but without -std=c99, then it works on both computers. gcc -O2 -pipe -m32 What is the problem with sscanf and c99 on CentOS x86 ? I thought that compiling with the -m32 flag would work on all Linuxes ? (I have limited access to the CentOS server, so I do not have access to error messages.)

    Read the article

  • Why doesn't the Visual Studio C compiler like this? [migrated]

    - by justin
    The following code compiles fine on Linux using gcc -std=c99 but gets the following errors on the Visual Studio 2010 C compiler: Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. fib.c fib.c(42) : error C2057: expected constant expression fib.c(42) : error C2466: cannot allocate an array of constant size 0 fib.c(42) : error C2133: 'num' : unknown size The user inputs the amount of Fibonacci numbers to generate. I'm curious as to why the Microsoft compiler doesn't like this code. http://pastebin.com/z0uEa2zw

    Read the article

  • Objective C -std=c99 usage

    - by Andy White
    Is there any reason why you shouldn't use the "-std=c99" flag for compiling Objective-C programs on Mac? The one feature in C99 that I really like is the ability to declare variables anywhere in code, rather than just at the top of methods, but does this flag causes any problems or create incompatibilities for iPhone or Cocoa apps?

    Read the article

  • Secure against c99 and similar shells

    - by Amit Sonnenschein
    I'm trying to secure my server as much as i can without limiting my options, so as a first step i've prevented dangerous functions with php disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode" but i'm still fighting directory travel, i can't seems to be able to limit it, by using a shell script like c99 i can travel from my /home/dir to anywhere on the disc. how can i limit it once and for all ?

    Read the article

  • Behavior with primitive data types' value out of range & C99's PRI* macros

    - by Yktula
    Say we have an 8-bit unsigned integer n (UINT8_MAX=255); what is the behavior of the compiler for n=256? Where can I find a table of default behavior when the value of a data type is out of range for different data types? Is there a pattern to how they behave when set out of range? #include <stdio.h> #include <inttypes.h> uint8_t n = UINT8_MAX; int main() { printf("%hhu ",n++); printf("%hhu",n); return 0; } Compiling with gcc -std=c99 -Wall *.c, this prints: 255 0 Also, is it acceptable to use C99's PRI* macros? How are they named?

    Read the article

  • C99 strict aliasing rules in C++ (GCC)

    - by Checkers
    As far as I understand, GCC supports all of its C99 features in C++. But how is C99 strict aliasing handled in C++ code? I know that casting with C casts between unrelated types is not strict-aliasing-safe and may generate incorrect code, but what about C++? Since strict aliasing is not part of C++ standard (is that correct?), GCC must be specifying the semantics itself. I figure const_cast and static_cast cast between related types, hence they are safe, while reinterpret_cast can break strict aliasing rules. Is this a correct understanding?

    Read the article

  • ISO C90 forbids mixed declarations and code Warning [Kernel Module Makefile]

    - by djTeller
    Hi, I'm trying to compile a linux kernel module using a Makefile which looks like so: obj-m += main.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean and i'm getting the following warning: main.c:54: warning: ISO C90 forbids mixed declarations and code I need to switch to C99. After reading i noticed i need to add a flag -std=c99, not sure where it suppose to be added. How do I change the Makefile so it will compile through C99 ? Thanks!

    Read the article

  • How, exactly, does the double-stringize trick work?

    - by Peter Hosey
    At least some C preprocessors let you stringize the value of a macro, rather than its name, by passing it through one function-like macro to another that stringizes it: #define STR1(x) #x #define STR2(x) STR1(x) #define THE_ANSWER 42 #define THE_ANSWER_STR STR2(THE_ANSWER) /* "42" */ Example use cases here. This does work, at least in GCC and Clang (both with -std=c99), but I'm not sure how it works in C-standard terms. Is this behavior guaranteed by C99? If so, how does C99 guarantee it? If not, at what point does the behavior go from C-defined to GCC-defined?

    Read the article

  • Mixed declarations and code in open source projects?

    - by Eduardo
    Why is still C99 mixed declarations and code not used in open source C projects like the Linux kernel or GNOME? I really like mixed declarations and code since it makes the code more readable and prevents hard to see bugs by restricting the scope of the variables to the narrowest possible. This is recommended by Google for C++. For example, Linux requires at least GCC 3.2 and GCC 3.1 has support for C99 mixed declarations and code

    Read the article

  • C99 variable length automatic array performance

    - by aaa
    Is there significant cpu/memory overhead associated with using automatic arrays with g++/Intel on 64-bit x86 linux platform? int function(int N) { double array[N]; overhead compared to allocating array before hand (assuming function is called multiple times) overhead compared to using new overhead compared to using malloc The range of N may be from 1kb to 16kb roughly, stack overrun is not a problem.

    Read the article

1 2 3 4 5  | Next Page >