ansi

C11 Standard docs

♀尐吖头ヾ 提交于 2019-12-02 21:02:55
Starting from this SO protected question I'm trying to understand what the difference between those documents: 9899 2012 costs $60 9899 2011 costs $265 As you can see those documents have very different prices and I don't know if the cheaper one is valid or is something like draft or cut copy of the real standard. Did someone buy the INCITS one? EDIT As @Chqrlie pointed out: What is the difference between the ANSI and ISO official documents available for a free and the final draft freely accessible from the official website at open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf LPs I finally got

passing arg 1 of `foo' from incompatible pointer type

醉酒当歌 提交于 2019-12-02 20:54:09
问题 Why this shows warning: #include<stdio.h> foo (const char **p) { } int main(int argc , char **argv) { foo(argv); } But following does not show any warning char * cp; const char *ccp; ccp = cp; The first code snippet shows warning passing arg 1 of foo from incompatible pointer type. But the second snippet does not show any warning. Both are const pointers 回答1: See the C FAQ list You can cast in order to remove warnings: foo((const char **)argv); But as FAQ says: the need for such a cast may

Getting Control Flow Graph from ANSI C code

萝らか妹 提交于 2019-12-02 16:01:10
I'm building tool for testing ansi c applications. Simply load code, view control flow graph, run test, mark all vertexes which was hit. I'm trying to build CFG all by myself from parsing code. Unfortunately It gets messed up if code is nested. GCC gives ability to get CFG from compiled code. I might write parser for its output, but I need line numbers for setting breakpoints. Is there way for getting line numbers when outputting Control Flow Graph with -fdump-tree-cfg or -fdump-tree-vcg ? For the control flow graph of a C Program you could look at existing Python parsers for C: PyCParser

passing arg 1 of `foo' from incompatible pointer type

*爱你&永不变心* 提交于 2019-12-02 11:12:21
Why this shows warning: #include<stdio.h> foo (const char **p) { } int main(int argc , char **argv) { foo(argv); } But following does not show any warning char * cp; const char *ccp; ccp = cp; The first code snippet shows warning passing arg 1 of foo from incompatible pointer type. But the second snippet does not show any warning. Both are const pointers See the C FAQ list You can cast in order to remove warnings: foo((const char **)argv); But as FAQ says: the need for such a cast may indicate a deeper problem which the cast doesn't really fix. Depending on your compilation flags, you might

Ansi escape sequences as bytes

别来无恙 提交于 2019-12-02 08:12:37
问题 Could someone run me through the bytes in the ansi escape sequences... I'm coding with pen and paper at the moment, and all the ansi tutorials list the codes as ESC[.... I need to see the actual bytes in the stream. Would one of you gurus with unlimited amount of time devoted to retards like me like to exemplify one or two sequences in bytes? Big thanks! 回答1: The first Google image hit for "ascii table". You're welcome. Just match the characters in the tutorial with the red characters, and

ANSI / Unicode conflict in batch file

夙愿已清 提交于 2019-12-02 08:01:09
I have some batch files that use a text file for language-independancy. Until yesterday all worked fine ... but then I began translating the standard texts to Dutch and German. Both languages use so called diacritical or accented characters like ä, ë, ö. I think Spanish will give the same problems with ñ. I created the text file with Notepad using standard encoding, which is ANSI. Just typing (DOS: TYPE) the file showed the wrong accented characters: e.g. ë showed as Ù. After I edited the text file and saved with Unicode encoding the DOS TYPE showed exactly what I typed in Notepad. At this

ANSI C: standard definition for the size of the __DATE__ and __TIME__ strings?

二次信任 提交于 2019-12-02 06:55:43
Is there a standard definition for the size of the __DATE__ and __TIME__ strings in ANSI C? The motivation behind this question is: I have two applications running on two different CPUs. During runtime, app #1 receives date and time (as part of version-info) from app #2. Of course, app #2 takes them from the preprocessor __DATE__ and __TIME__ definitions. So I would like to know whether or not I can statically allocate in app #1 an array, into which I can copy the info received from app #2. Thanks Vignesh Kumar A __DATE__ The date of translation of the source file (a character string literal

Redirect stdout to file without ANSI warnings

馋奶兔 提交于 2019-12-02 05:57:14
问题 I've been trying to get a program's STDOUT redirecting to a file. So far, this code works well: FILE *output = fopen("output","w"); if (dup2(fileno(output),1) == -1) { /* An error occured. */ exit(EXIT_FAILURE); } The issue is, I'm trying to stick to ANSI C, and fileno isn't ANSI. When I compile with gcc I get the warnings: gcc -Wall -ansi -pedantic warning: implicit declaration of function ‘fileno’ Is there any way at all to redirect STDOUT to a file in ansi C? 回答1: The ANSI C way to do it

Ansi escape sequences as bytes

六眼飞鱼酱① 提交于 2019-12-02 04:13:52
Could someone run me through the bytes in the ansi escape sequences... I'm coding with pen and paper at the moment, and all the ansi tutorials list the codes as ESC[.... I need to see the actual bytes in the stream. Would one of you gurus with unlimited amount of time devoted to retards like me like to exemplify one or two sequences in bytes? Big thanks! The first Google image hit for "ascii table". You're welcome. Just match the characters in the tutorial with the red characters, and take the corresponding hex value! Escape is 0x1B and [ is 0x5B, so you want 1B5B. You may look for ANSI

Redirect stdout to file without ANSI warnings

不问归期 提交于 2019-12-02 00:53:08
I've been trying to get a program's STDOUT redirecting to a file. So far, this code works well: FILE *output = fopen("output","w"); if (dup2(fileno(output),1) == -1) { /* An error occured. */ exit(EXIT_FAILURE); } The issue is, I'm trying to stick to ANSI C, and fileno isn't ANSI. When I compile with gcc I get the warnings: gcc -Wall -ansi -pedantic warning: implicit declaration of function ‘fileno’ Is there any way at all to redirect STDOUT to a file in ansi C? The ANSI C way to do it is freopen() : if (freopen("output", "w", stdin) == NULL) { /* error occured */ perror("freopen"); } 来源: