Skip to content

Commit 41a1d2b

Browse files
Merge pull request #4711 from JackStouffer/patch-20
[trivial] Improved some docs in std.stdio
2 parents b2aacbf + e936f33 commit 41a1d2b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

std/stdio.d

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,14 +3258,20 @@ struct LockingTextReader
32583258
}
32593259

32603260
/**
3261-
* Indicates whether $(D T) is a file handle of some kind.
3261+
* Indicates whether $(D T) is a file handle, i.e. the type
3262+
* is implicitly convertable to $(LREF File) or a pointer to a
3263+
* $(REF FILE, core,stdc,stdio).
3264+
*
3265+
* Returns:
3266+
* `true` if `T` is a file handle, `false` otherwise.
32623267
*/
32633268
template isFileHandle(T)
32643269
{
32653270
enum isFileHandle = is(T : FILE*) ||
32663271
is(T : File);
32673272
}
32683273

3274+
///
32693275
@safe unittest
32703276
{
32713277
static assert(isFileHandle!(FILE*));
@@ -3275,14 +3281,20 @@ template isFileHandle(T)
32753281
/**
32763282
* Property used by writeln/etc. so it can infer @safe since stdout is __gshared
32773283
*/
3278-
private @property File trustedStdout() @trusted { return stdout; }
3284+
private @property File trustedStdout() @trusted
3285+
{
3286+
return stdout;
3287+
}
32793288

32803289
/***********************************
32813290
For each argument $(D arg) in $(D args), format the argument (as per
32823291
$(LINK2 std_conv.html, to!(string)(arg))) and write the resulting
32833292
string to $(D args[0]). A call without any arguments will fail to
32843293
compile.
32853294
3295+
Params:
3296+
args = the items to write to `stdout`
3297+
32863298
Throws: In case of an I/O error, throws an $(D StdioException).
32873299
*/
32883300
void write(T...)(T args) if (!is(T[0] : File))
@@ -3307,9 +3319,15 @@ void write(T...)(T args) if (!is(T[0] : File))
33073319
}
33083320

33093321
/***********************************
3310-
* Equivalent to $(D write(args, '\n')). Calling $(D writeln) without
3322+
* Equivalent to `write(args, '\n')`. Calling `writeln` without
33113323
* arguments is valid and just prints a newline to the standard
33123324
* output.
3325+
*
3326+
* Params:
3327+
* args = the items to write to `stdout`
3328+
*
3329+
* Throws:
3330+
* In case of an I/O error, throws an $(LREF StdioException).
33133331
*/
33143332
void writeln(T...)(T args)
33153333
{

0 commit comments

Comments
 (0)