So I have a function that I’ve depreciated, what I’d like is for the compiler to issue a warning or error, but only if that function is being used in the current project. It’s in a shared object, that’s used in almost all my projects.
Is this possible?
#pragma error "This function is depreciated, please use ""window.makeVibrant"" instead."
displays even when the function isn’t being used, I only want to see the error if the function is actually used in that project.
Thanks Kem, it only shows up when checking the project. I’d like it to show up when debugging or building the project (but only if it’s actually used in the project).
I’ve had this conversation with others, yet I can’t help myself in spelling in that way.
depreciate - diminish in value over a period of time
deprecate - express disapproval of
So are we removing the functions or disliking them
[quote=227310:@Sam Rowlands]Thanks Kem, it only shows up when checking the project. I’d like it to show up when debugging or building the project (but only if it’s actually used in the project).
[/quote]
Deprecation is a pleasant means to say “Hey you should update your code”
If you want it to fail when you compile just rename the method or remove it
That forces the issue
[quote=227382:@Norman Palardy]If you want it to fail when you compile just rename the method or remove it
That forces the issue[/quote]
I was just hoping of a way to remind me (and anyone else who uses my code) of what the replacement mechanism is.
Deprecation would be that means but until you actually remove it its not a required update to code.
Same as on our front where we deprecate a feature and a lot of people never notice until we outright remove it
Maybe I should file a feature request, I personally think it would be better to be pro-active and alert the user when they build, rather than relying on them using the verification function to see what should be updated.
Couple different things I can think you might ask for
a attribute “ErrorOnDeprecation” or something like it that causes an error about the deprecation
That’d be very “in your face” about it
a “deprecations are errors” compiler setting kind of like some compilers have a means to treat all warnings as errors
The first would be a means for a library author to “force” people to update their code
I suspect you’d get complaints about such a thing
The second would be user settable so under their control - much like it is today
Able to ignore it until they felt it was time to do something about it - like when the method is removed from an updated version
It doesn’t compile the code which is what would be required to know if you’ve used a method marked as deprecated.
Examining a controls parentage is a simple walk up a list of supers seeing if any has a deprecated attribute.
[quote=227526:@Norman Palardy]It doesn’t compile the code which is what would be required to know if you’ve used a method marked as deprecated.
Examining a controls parentage is a simple walk up a list of supers seeing if any has a deprecated attribute.[/quote]
That makes sense.