www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to make the compile time red color warning ?

reply =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
Use case:
I have class for Windows OS.
I not implement class for Linux.
I want message about it. When code compiled under Linux.


Example:


version ( Windows )
{
     public import ui.sys.windows.event.keyboardevent;
}
else
{
     pragma( msg, "Unsupported OS" );
}


How to make red color message ?
pragma( msg, "Unsupported OS" );



Or may be call compiller warning_message() function ? Such exists 
?

Thanks.
Jun 03 2020
parent reply MrSmith <mrsmith33 yandex.ru> writes:
On Wednesday, 3 June 2020 at 11:48:27 UTC, Виталий Фадеев wrote:
 Use case:
 I have class for Windows OS.
 I not implement class for Linux.
 I want message about it. When code compiled under Linux.
You could use `static assert(false, "Message");` to make it an error.
Jun 03 2020
parent =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
On Wednesday, 3 June 2020 at 11:56:26 UTC, MrSmith wrote:
 On Wednesday, 3 June 2020 at 11:48:27 UTC, Виталий Фадеев wrote:
 Use case:
 I have class for Windows OS.
 I not implement class for Linux.
 I want message about it. When code compiled under Linux.
You could use `static assert(false, "Message");` to make it an error.
That is true! I happy!
Jun 03 2020