There's already a design in place, we have several classes and headers giving us thousands of lines of source code. I gave myself the requirement....it's my project, i simplified the problem to its...
Type: Posts; User: tempster09
There's already a design in place, we have several classes and headers giving us thousands of lines of source code. I gave myself the requirement....it's my project, i simplified the problem to its...
That's the problem, I don't know how to code a solution since I have no idea how to approach it. I don't actually need a solution just a starting point maybe, like an idea of how to approach it. Or...
What's the best distribution algorithm to use if I want to place numbers 1, 2, and 3 in an array. The array can be variable length and so can the number of occurrences of 1,2,and 3. The array is...
Thanks, I didn't really think it was possible to do something like that in C but I forgot I have done things like your macro in the past. That's exactly what I was looking for. These functions will...
What's macro magic? This isn't a one time solution, when we recompile under different circumstances we may have 4 functions today, 8 tomorrow, 3 the next day etc..It's the nature of the program,...
Below is what I want to accomplish. These function pointers depend on how many functions I will be creating. They will always follow the pattern function1, function2, etc.. where it will be...
is there a way to assign weights to indices in an array than use those to influence my choice? I want to write a function to randomly choose indices based on these weights (this way if there are 0...
This questions is regarding conditional #define's. I was curious if I could use the pre-processor to figure out the value of a #define, or if in fact a #define is defined or undefined.
example"
...
that's what i thought, but was hoping there was another answer. That's too bad, i was even thinking of writing a function to do it for me but i would never know when to stop counting positions in an...
In C, i used a define when i first was learning which was something like:
#define LENGTH(array) (sizeof(array)/sizeof(array[0]))
or something along those lines in order to be able to...
void func1( int i ){} //pass by reference (can't manipulate contents unless i is global
void func2( int *i ){} //pass by address (manipulate contents of non-local variable
int i;
func1( i );...
Ya, just set your biggest number to 0, loop through all numbers saying if this number is bigger, set it to your current number. Than you only need one if statement (two if you do the smallest number...
What's the easiest (well not easiest), but best method for memory management if i'm allocating memory for structs, strings, arrays, etc.. Is there some way I could just store all the pointers in a...
Well i should have mentioned I exhausted all of the simple options already, and can't use certain options. I would like to avoid the overhead of a function which allocates memory for a string,...
Thanks for enlightening me as opposed to helping me, i'll come up with something I guess. Thanks anyways. I mean why is it so difficult to give me a straight answer about grouping all three of...
No, essentially what's going on is this
main.c
int main()
{
//call function in external file extern.c
extern(__FILE__,__LINE__,__func__)
}
Actually you are mistaken. __FILE__ is a string literal and can be concatenated, as I have done so with __FILE__ and __LINE__ by stringifying __LINE__. __FUNCTION__ aka __func__ is a treated as a...
This works:
void myfunction( const char *file,const char *function, int index, int value )
{
// code
}
#define myfunction(...) myfunction( __FILE__, __func__, __VA_ARGS__ )
Ya, my current compiler is at 4.xx as well.
RE:
Basically, i guess i need a way to concatenate two const char *, because __func__ is a variable and Ive already got a string containing the LINE...
don't rush, it's the holidays, don't make me a priority lol.
I'm only working with GCC probably 3.0+, across linux platforms. I think __FUNCTION__ is supported by GCC and expanded to a string...
Is stringification, ... (ellipsis), and __FUNCTION__ C99 compliant? I don't want to be writing code thats gonna crap out across platforms.
I can simply use __FUNCTION__ in my "ASSERT" define,...
Well than how can I do it appropriately for non-windows platforms? I am currently using linux, it is for unix, and I would like it to be portable. How does assert do it?
I have re-written assert to serve my own purpose. I want to hide debug implementation details from the "callers" using functions. Basically, a string parameter in my functions will be hidden from...
Yes, i'm afraid your not understanding me. I need acurate and graceful/informational data failure in development and testing phase because the software is out of "my" hands and being tested or...
Using the debugger is a must regardless, I am just trying to make it easier for someone debugging to have a file and line to debug at. A function that is being called is external to the main area...