On Jan 24, 2008 3:19 PM, Christopher Carver
<[EMAIL PROTECTED]> wrote:
> I have an application where I want to generate unique error codes
> depending on the path the code takes (call stack).

[snip]

Sounds like what a lot of other tools out there do during development
work. Sounds like you want something for production however. Not
something I'd advocate. However...

Have a global variable, and (re-)hash it every time at the start of a
function call (or wherever in your code you want a path to be noted)
with either a fixed number or the current line number in that file.
The eventual hash should give you some sort of indication of the path
taken.

static hash_val;
void rehash(long l_val){
   // your hash function here to change hash_val with l_val)
}

int foo(...){
   rehash(__LINE__);
   // body of foo();
}

float bar(...){
   rehash(__LINE__);
   // body of bar();
}

... etc.


Generating the lookup table will not be fun however.


-- 
PJH

http://shabbleland.myminicity.com

Reply via email to