Re: Functions & Procedure runing stak

new topic     » goto parent     » topic index » view thread      » older message » newer message
clkeriolet said...

I have a few procedures that need to know from where(with the path) among hundreds they have been called, so I can take proper action.

The traditional approach is to supply a parameter to determine that sort of thing, for example

enum MOVE, COPY, DELETE 
procedure process_file(integer action, ...) 
   ... 
end procedure 
 
procedure move_file(...) 
   process_file(MOVE,...) 
end procedure 
 
procedure copy_file(...) 
   process_file(COPY,...) 
end procedure 
 
procedure delete_file(...) 
   process_file(DELETE,...) 
end procedure 

rather than have process_file try to figure out which routine it was called from.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu