ansi

Non-standard function return types: Fixing Splint parse error

随声附和 提交于 2019-12-14 02:40:42
问题 I'm using the embedded-system XC8 C compiler (for PIC microprocessors). The following is allowed: bit foo(){ //... } but being non-standard C, the Splint static analyser gives the following error: Parse Error: Non-function declaration: bit : "--------------------------------------" int. And the file/line of the error is the function prototype in the respective .h file. How can I fix this so Splint can analyse the rest of the file(s)? I think there might be two ways: I think I remember seeing

Compiling ANSI C++ code on Mac OS X [closed]

别来无恙 提交于 2019-12-13 23:11:03
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm struggling to compile and run a program on Mac OS X, which is written using ANSI/ISO C++ (Windows). Source code I've tried to compile using g++, and by importing the files and compiling using Xcode. If i try to compile using g++ (command line), I get a couple of warning, which are easy to fix,: e.g. warning:

ANCI C (C90): Can const be changed?

江枫思渺然 提交于 2019-12-13 05:38:45
问题 I am confused as to what ANSI specification says about changing a variable declared const can be legally modified through its address. Unfortunately I do not have access to C90 specification but got conflicting pointers: The keyword const doesn't turn a variable into a constant! A symbol with the const qualifier merely means that the symbol cannot be used for assignment. This makes the value re ad -onl y through that symbol; it does not prevent the value from being modified through some other

-pedantic warning and pthread_create

谁说胖子不能爱 提交于 2019-12-13 02:34:39
问题 I'm newbie in the ansi and iso world, i compiled my program with : -asni -pedantic -std=c++11 -std=c++98 Now, i get the following warning: warning: converting from 'void (NetworkSocket::*)()' to 'void* (*)(void*)' [-pedantic] for the following line: if (pthread_create(this->threadArray, NULL, (void*(*)(void*)) &NetworkSocket::threadProcedure , (void *)this) != 0) { /* error */ } How can i pass pedantic warning? 回答1: pthread_create is a C function expecting a C function taking a void pointer,

Validate scanf parameters

若如初见. 提交于 2019-12-12 19:33:12
问题 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". 回答1: scanf will stop scanning as soon as the first encountered symbol that does not match a format specifier. So if your scanf returns 1 then only the first format parameter was interpreted. switch (scanf("%c,%f,%f", &ch, &p1, &p2)) { case 0: // no parameters were parsed

‘struct in6_addr’ has no member named ‘s6_addr32’ with -ansi

孤人 提交于 2019-12-12 12:58:16
问题 I'm working through some compile errors when building OpenSSL with no-asm -ansi . I'm catching the error: $ ./config no-asm -ansi ... $ make ... gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines\"" -Wall -O3 -pthread -m64 -DL_ENDIAN -ansi -fPIC -Iinclude -I. -Icrypto/include -MMD -MF crypto/bio/bss_dgram.d.tmp -MT crypto/bio/bss_dgram.o -c -o crypto/bio/bss_dgram.o crypto/bio/bss

VT100 ANSI escape sequences: getting screen size, conditional ANSI

青春壹個敷衍的年華 提交于 2019-12-12 10:55:24
问题 When I resizing on terminal, it keeps full screen. I guess, there's someway that can find out what screen size the terminal is. How can I do that in VT100? With , when I list folder, it shows folder in blue color. (or let's say different color) But, if you save output into a text file ( ls > out.txt ), you don't see any ANSI code but plain text. However, if you try ( vi > out.txt ), you will see ANSI code. How does know that? Thank you 回答1: Programs (such as vi ) which automatically adjust to

How can I set the brown color using ANSI escape sequence?

只谈情不闲聊 提交于 2019-12-12 04:17:21
问题 Can I use only the sequence Esc[Value,Valuem to set the brown color of background? (not only Black, Red, Green, Yellow, Blue, Magenta, Cyan, White... I want use more colors). How to implement it easily? I want to implement it in my boot code, so I haven't the opportunity to use standard libraries. Which parameters should I use? 回答1: ANSI defined only 8 colors. None are brown (though some people call the non-bright "yellow" a "brown", e.g., Yellow appears as brown in konsole). If you want to

search a string in an array of strings

心不动则不痛 提交于 2019-12-11 07:54:09
问题 I keep getting bad pointers. Can anyone tell me what am I doing wrong? int SearchString( char* arr[], char* key, int size ) { int n; for ( n = 0; n < size; ++n ) { if ( strcmp(arr[n], key) ) { return n; } } return -1; } char str[][16] = { "mov","cmp","add","sub","lea","not","clr","inc","dec","jmp","bne","red","jrn","psr","rts","stop"}; if(SearchString(str,"word",16) == -1){ return FALSE;} 回答1: Can't tell where your word originates from. You probably want to if (!strcmp(arr[n],key)) return n;

Javascript Convert ansi to utf8

此生再无相见时 提交于 2019-12-10 18:52:55
问题 i'm trying with this plugin jquery.csvToTable to show data from csv to web page , cvs file has encoding ansi with Japanese text , but webpage has encoding utf8 , and js is not working with ansi , how is possible to convert or if exist another method data $.get(csvFile, function(data) { data to utf8 , sorry for my bad English , thanks a lot ! 回答1: By the time you're dealing with a string in JavaScript, you're dealing with UTF-16. It's up to the browser to ensure that any data it passes to the