In gcc I can do compile-time warnings like this:
#if !defined(_SOME_FEATURE_)
#warning _SOME_FEATURE_ not defined-- be careful!
#endif
But in Visual Studio this doesn't work. Is there an alternative syntax for #warning?
...
I have many (~100 or so) filter coefficients calculated with the aid of some Matlab and Excel that I want to dump into a C header file for general use, but I'm not sure what the best way to do this would be. I was starting out as so:
#define BUTTER 1
#define BESSEL 2
#define CHEBY 3
#if FILT_TYPE == BUTTER
#if FILT_ROLLOFF == 0.010...
Today, looking at the man page for open(), I've noticed this function is 'overloaded':
int open(const char *pathname, int flags);
int open(const char *pathname, int flags, mode_t mode);
I didn't thought it's possible on C. What's the 'trick' for achieving this ?
LATER EDIT:
So it's not really overloading, because when using va...
Hello. I am using setjmp and longjmp for the first time, and I ran across an issue that comes about when I wrap setjmp and longjmp. I boiled the code down to the following example:
#include <stdio.h>
#include <setjmp.h>
jmp_buf jb;
int mywrap_save()
{
int i = setjmp(jb);
return i;
}
int mywrap_call()
{
longjmp(jb, 1);
printf(...
Is there a way to force bison and/or flex to restart scanning after I replace some token with something else?
My particular example would be with replacement for a specific word/string. If I want a word of hello to be replaced by echo hello, how can I get flex or bison to replace hello and then start parsing again (to pick up 2 words i...
I was trying to compile a ruby module, and my compiler choked. I think it might have something to do with a line in ruby.h:
void rb_check_type _((VALUE,int));
I've never seen this _ syntax before. What does it mean? Could it cause problems for my compiler (Visual Studio)?
...
I am trying to use html/javascript to run a local .exe file in a local browser. The .exe file will generate asci text and I have it programed to encapsulate the text in html legible to the browser. But I want to have it load the new output from the .exe in the current browser, replacing whats there now.
...
Possible Duplicates:
Why are there sometimes meaningless do/while and if/else statements in C/C++ macros?
do { } while (0) what is it good for?
I'm working on some C code filled with macros like this:
#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
Can anyone explain what this macro does, and w...
Could somebody tell me what is the proper way to convert a NSString* to an ANTLR3 string (used in C) ?
EDIT: this seems to work
char buf[255];
if ( YES == [myNSString getCString:buf maxLength:255 encoding:NSStringEncodingConversionAllowLossy] )
{
pANTLR3_UINT8 theExpression = (pANTLR3_UINT8*)buf;
...
...
I have the simple function below which swap two characters of an array of characters (s). However, I am getting a "Unhandled exception at 0x01151cd7 in Bla.exe: 0xC0000005: Access violation writing location 0x011557a4." error. The two indexes (left and right) are within the limit of the array. What am I doing wrong?
void swap(char* s, i...
As the question states, what exactly are the implications of having the 'implicit declaration of function' warning? We just cranked up the warning flags on gcc and found quite a few instances of these warnings and I'm curious what type of problems this may have caused prior to fixing them?
Also, why is this a warning and not an error...
I read somewhere that it is disastrous to use free to get rid of an object not created by calling malloc, is this true? why?
...
It's known that calloc differentiates itself with malloc in which it initializes the memory alloted. With calloc, the memory is set to zero. With malloc, the memory is not cleared.
So in everyday work, i regard calloc as malloc+memset.
Incidentally, for fun, i wrote the following codes for benchmark. The result is confused.
Code 1:
#in...
Hi i am new to windows system programming and interested in working in it completely using C and win32 api. Can you please give me suggestions on how I can start and any good books to read. Thanks in advance.
...
Possible Duplicate:
Uses for multiple levels of pointer dereferences?
I have used functions with doubly dereferenced pointers (**var) to return values. However, I was recently asked a question to figure out a use-case where a triple dereferencing (***var) may be needed. I couldn't think of any practical scenario. Does anyone h...
I've not been successful in finding help with this issue. What I want to do is following: I have some C-based executables that implement the server side logic. There should be one process running this executable per client. The process should be invoked upon the first HTTP request form the client and killed once a specific HTTP request c...
I was just checking an answer and realized that CHAR_BIT isn't defined by headers as I'd expect, not even by #include <bitset>, on newer GCC.
Do I really have to #include <climits> just to get the "functionality" of CHAR_BIT?
...
Please consider following use case,
I have one bigger image, lets called is master image.
Now from some where else, I am getting one small image. I want to check whether this small image is subset of master image or not.
important points are,
smaller image might have different file format,
smaller image might captured from comparati...
I have a certain 18 bits (which are in 2's complement) within 32 bits. I need to convert them to decimal. Please show me a code snippet in C.
Thanks !
...
what are the data structures used in ATM Machines?
...