IMHO one purpose to write IF 1 = 0 code is to enable the cross reference of message raised in application code.
I have written several blogs to discuss the tip how to find the source code where the error message in UI is raised.
Most of the time you have to debug. ( Of course you can use source code scann approach to search the source code with keyword CRM_MDG_CORE 034 , the trouble is how you specify the package to be scanned, especially you are not familar with the application and you know nothing about package name at all )
The where used List on message could only identify those occurrence where the MESSAGE keyword appears in code.
For the use case in line 24 and 25 below, the where used list does not work. That is when IF 1 = 0 plays a part.
Recently in our code review meeting there are some arguments about this usage. The pros like this approach since it enable the cross reference on message raising by method call and ease the maintenance. The opposition consider that it is “unreached code” and should not appear in production code.
I just check in the system and find there are plenty of such usage in SAP standard code, also I tested that currently no ATC or extended check profile will complain about this “unreached code”. Would you please kindly share your opinion of using IF 1 = 0 this way? Or do you have any concern about it?