Questions tagged [ansi-c]

ANSI C is an informal term sometimes used when referring to the C programming language standard published by the American National Standards Institute (ANSI) in 1989 .

"ANSI C" is an informal term used to refer to the 1989 version of the C language. The formal name for this version of the language is ISO/IEC 9899:1990. Informally it is also known as "C89" or "C90".

This is because the American National Standards Institute (ANSI) first published this standard in the year 1989, as a national standard for the USA. It became international ISO standard in the year 1990. So ANSI C, C89 and C90 all refer to the same technical standard.

It is a common misunderstanding that "ANSI C" means standard compliant C. The ANSI standard institute haven't had anything to do with C since 1989. The language is maintained by ISO SC22/WG14. Yet the term "ANSI C" is sometimes used to mean standard compliant, particularly in old books and by old compilers.

Because of this ambivalent meaning, please avoid using this tag. For questions regarding the C89/C90 version of the C language, please use . For questions regarding standard-compliant C, simply use the tag.

Further information about the different C standard versions.

618 questions
2
votes
1 answer

How to suppress a 'missing termination character' warning in cpp?

I'm trying to use cpp (ANSI-C preprocessor) to preprocess some non ANSI-C files. These files contain assembly instruction in PicoBlaze syntax. PicoBlaze uses 'd to annotate the literal's radix. I would like to preprocess my files with cpp. I get…
Paebbels
  • 15,573
  • 13
  • 70
  • 139
2
votes
1 answer

Native ANSI C library from .NET Framework >= 4 on 64 Bit

I have a C# application that (P/)invokes an ANSI C library, provided by the manufacturer, to access an RFID-Reader over the network. This works absolutely fine with .NET Framework versions 2.0 up to 4.5 if I manually set the platform to x86. With…
Pascal
  • 105
  • 4
2
votes
3 answers

How to avoid Passing config variable in every function which uses this configurtation

How can I avoid passing a "config" variable in every function which uses this configuration. what is the most accurate way to make such a behavior. This is my code: main.c /* Complex Numbers Linking to proper variable */ typedef struct…
D_R
  • 4,894
  • 4
  • 45
  • 62
2
votes
1 answer

Validate scanf parameters

I need to validate the scanf parameters for example if (scanf("%c,%f,%f", &ch, &p1, &p2) != 3) // How can I tell which parameter failed? // If I want to output message such as "Second parameter must be a real nubmer".
D_R
  • 4,894
  • 4
  • 45
  • 62
2
votes
4 answers

memcpy with char * not working

char recBuffer[8024]; char* temp = (char*)malloc(65536); ZeroMemory(recBuffer, 8024); ZeroMemory(temp, 65536); bytesRead = recv(_socket, recBuffer, sizeof(recBuffer), 0); memcpy(temp , &recBuffer, bytesRead ); memcpy doesn't work here. It copies…
Vans S
  • 1,743
  • 3
  • 21
  • 36
2
votes
2 answers

Different results with ON/OFF modes of strict compliance with ANSI C

Why when the ON or OFF mode of strict compliance with ANSI C program produces different results? Compliance with strict about writing of the reasons that most modern industrial compilers default to some expansion of its own language, and some by…
Amazing User
  • 3,473
  • 10
  • 36
  • 75
2
votes
2 answers

Initializing struct in C, best practice

I'm getting a compile time error during initialization of the members structure in this code. What can be some other methods to initialize the below array structure. Thank you! #include #include #define MAX_FUNC_MEMBERS…
alphadog
  • 10,473
  • 2
  • 13
  • 19
2
votes
2 answers

GCC makefile doesn't accept -std=c99 -lm

I am having problem with my makefile with gcc compiler. If I use gcc directly as: gcc -std=c99 -lm tm.c tm_coins.c tm_options.c tm_stock.c tm_utility.c -o tm -Wall -pedantic Everything works fine. I need -std-c99 and -lm. However, I have been told…
Oscar
  • 233
  • 2
  • 6
  • 15
2
votes
1 answer

ANSI C - Program received signal SIGSEGV, Segmentation fault

I am using ANSI C and getting "Program received signal SIGSEGV, Segmentation fault." for my below code when I run it. Compiling is fine. No error there. #define MAX_LINE_SIZE 1024 #define DELIMITER "," #define TICKET_NAME_LEN 40 #define…
Oscar
  • 233
  • 2
  • 6
  • 15
2
votes
1 answer

Converting pre-ANSI C function declarations with fixed array sizes to ANSI

I'm new to C (well, RUSTY in C at least) and I'm working on some pre-ANSI C code in Visual Studio 2010. It compiles fine, but Intellisense is going crazy over the function declarations: int add() int a, int b; { return a + b; } instead of…
James Cronen
  • 5,715
  • 2
  • 32
  • 52
2
votes
5 answers

A function with an int or void return type can be called before declaring and defining?

I read in "The C Programming Language ANSI edition by Kernighan and Ritchie" that if I call a function with a return type either int or void inside another function before actually declaring/defining it, it should work perfectly. But when I run it…
amiageek
  • 159
  • 10
2
votes
3 answers

ANSI C All-Bits-Set Type-Promotion Safe Literal with -Wsign-conversion

Can I set all bits in an unsigned variable of any width to 1s without triggering a sign conversion error (-Wsign-conversion) using the same literal? Without -Wsign-conversion I could: #define ALL_BITS_SET (-1) uint32_t mask_32 =…
2
votes
3 answers

Splitting Unix command for use with exec

I have a program which takes command from input, and then executes it using execl (it has to be function from execvp family). Right now, assuming the input line is in , can I simply use execl(allBeforeFirstSpaceFromIn, in); , or do I have to divide…
Xyzk
  • 1,332
  • 2
  • 21
  • 36
2
votes
2 answers

Class constructor "C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>"

this is my first post. I read a lot of topics, and seems I've done all right, but I get the above error again when I try to compile the following code : // Header file #include #include #include using namespace…
Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
2
votes
1 answer

Sorting array won't work in ANSI C

I'm writing a code in ANSI C, this code has to accomplish a single, easy task: sort the array search in an array for an element return element position if found else return -1 I defined my function like this: int search_sorted(int *array, int…
Yuri Scarbaci
  • 1,475
  • 2
  • 11
  • 13