From b9edc4a4149c784da18995856bf14224a0a09285 Mon Sep 17 00:00:00 2001 From: Ben-Fields <33070053+Ben-Fields@users.noreply.github.com> Date: Sun, 21 Feb 2021 03:56:34 -0600 Subject: [PATCH] docs: document the `[console]` attribute (#8870) Document the [console] attribute in docs.md. Co-authored-by: Ben-Fields <> --- doc/docs.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 5ed38f0d91..360ad93900 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3938,8 +3938,8 @@ On Unix-like platforms, the file can be run directly after making it executable V has several attributes that modify the behavior of functions and structs. -An attribute is specified inside `[]` right before a function/struct declaration -and applies only to the following declaration. +An attribute is a compiler instruction specified inside `[]` right before a +function/struct/enum declaration and applies only to the following declaration. ```v // Calling this function will result in a deprecation warning @@ -3976,6 +3976,14 @@ struct C.Foo { // Used in Win32 API code when you need to pass callback function [windows_stdcall] fn C.DefWindowProc(hwnd int, msg int, lparam int, wparam int) + +// Windows only: +// If a default graphics library is imported (ex. gg, ui), then the graphical window takes +// priority and no console window is created, effectively disabling println() statements. +// Use to explicity create console window. Valid before main() only. +[console] +fn main() { +} ``` ## Goto