Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1015)

Unified Diff: doc/articles/c_go_cgo.html

Issue 9953043: code review 9953043: doc/articles: use C90 standard functions in the cgo article. (Closed)
Patch Set: diff -r bc2993c5834f https://code.google.com/p/go/ Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | doc/progs/cgo1.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: doc/articles/c_go_cgo.html
===================================================================
--- a/doc/articles/c_go_cgo.html
+++ b/doc/articles/c_go_cgo.html
@@ -11,8 +11,8 @@
<p>
To lead with an example, here's a Go package that provides two functions -
-<code>Random</code> and <code>Seed</code> - that wrap C's <code>random</code>
-and <code>srandom</code> functions.
+<code>Random</code> and <code>Seed</code> - that wrap C's <code>rand</code>
+and <code>srand</code> functions.
</p>
{{code "/doc/progs/cgo1.go" `/package rand/` `/END/`}}
@@ -30,14 +30,14 @@
<p>
The <code>rand</code> package contains four references to the <code>C</code>
-package: the calls to <code>C.random</code> and <code>C.srandom</code>, the
+package: the calls to <code>C.rand</code> and <code>C.srand</code>, the
conversion <code>C.uint(i)</code>, and the <code>import</code> statement.
</p>
<p>
The <code>Random</code> function calls the standard C library's <code>random</code>
-function and returns the result. In C, <code>random</code> returns a value of the
-C type <code>long</code>, which cgo represents as the type <code>C.long</code>.
+function and returns the result. In C, <code>rand</code> returns a value of the
+C type <code>int</code>, which cgo represents as the type <code>C.int</code>.
It must be converted to a Go type before it can be used by Go code outside this
package, using an ordinary Go type conversion:
</p>
@@ -54,7 +54,7 @@
<p>
The <code>Seed</code> function does the reverse, in a way. It takes a
regular Go <code>int</code>, converts it to the C <code>unsigned int</code>
-type, and passes it to the C function <code>srandom</code>.
+type, and passes it to the C function <code>srand</code>.
</p>
{{code "/doc/progs/cgo1.go" `/func Seed/` `/END/`}}
« no previous file with comments | « no previous file | doc/progs/cgo1.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b