Overload #define

Hi everyone,
I am trying to do something like this if it is possible? I appreciate any help.
Thanks.

#define A 0x10FFE7

void func(int value){
Serial.print(value);
}

.
.
.

somewhere in the code
A = value;

when I do this I want the func() to be called.

A is not a variable - you can't assign anything to it.

Thank for ur answer
I know that and I am not trying to do that
I want to do some thing similar to overload operator with classes if it possible

I know that and I am not trying to do that

So why did you post it?

Time-wasting.

muaiyd:
Thank for ur answer
I know that and I am not trying to do that
I want to do some thing similar to overload operator with classes if it possible

Perhaps it would be better if you described what you want to do rather than asking about possible solutions to an unspecified problem

Thank you very much
I am using define to hold information about 1000 register. Each value content register address length and which part of the memory. This is a modified lib to minimise the size to make it work in small microcontroller. The original is using class to hold the registers information so when a valye is assigned to a class the class overload the operator and use the register info to write the value in the right memory. what I am trying to is using define instead of the classes but i dont want to rewrite the whole lib so if there is a way to do the overloading will be perfect.
Thanks

Understand a few things. #define is a pre-processor directive that functions as a text replacement mechanism. What this means is that #define xyz abc will replace every instance of xyz with abc. This also means that wxyz becomes wabc.

When you use it as a function type macro with parameters, the parameters are type agnostic, meaning that they are defined without reference to a data type. So #define square(x) x*x will be valid regardless of the type for x. In this way macros can be used to overload a function with regard to data type. Bear in mind though, that this is a pre-compile directive and as such there is know knowledge about the value of a variable.

DKWatson:
Understand a few things. #define is a pre-processor directive that functions as a text replacement mechanism. What this means is that #define xyz abc will replace every instance of xyz with abc. This also means that wxyz becomes wabc.

...

This matches neither what I thought nor the results of a sanity check experiment. The preprocessor will not look into "wxyz", find "xyz" and substitute "abc" to result in "wabc".

What did you mean?

a7

alto777:
This matches neither what I thought nor the results of a sanity check experiment. The preprocessor will not look into "wxyz", find "xyz" and substitute "abc" to result in "wabc".

What did you mean?

a7

Of course it won't do that. That would make #define completely unusable. Think about the impact of doing something like:

#define f XXX
#define s YYY

Suddenly your for statement would be XXXor? Your switch would become YYYwitch? Ridiculous!
The PP parses the code, and replaces symbols, NOT random bits and pieces of strings.
Regards,
Ray L.

Thank all of you,
I know how the define is working and I just wondered if there is a way to move around to do easy programming and it look like there is no way.
Regards

muaiyd:
Thank all of you,
I know how the define is working and I just wondered if there is a way to move around to do easy programming and it look like there is no way.
Regards

Nope, still no idea what you're going on about.

http://xyproblem.info/