docs: document the `[console]` attribute (#8870)

Document the [console] attribute in docs.md.

Co-authored-by: Ben-Fields <>
pull/8879/head
Ben-Fields 2021-02-21 03:56:34 -06:00 committed by GitHub
parent 9a744b6750
commit b9edc4a414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -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. V has several attributes that modify the behavior of functions and structs.
An attribute is specified inside `[]` right before a function/struct declaration An attribute is a compiler instruction specified inside `[]` right before a
and applies only to the following declaration. function/struct/enum declaration and applies only to the following declaration.
```v ```v
// Calling this function will result in a deprecation warning // 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 // Used in Win32 API code when you need to pass callback function
[windows_stdcall] [windows_stdcall]
fn C.DefWindowProc(hwnd int, msg int, lparam int, wparam int) 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 ## Goto