Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
9il committed Apr 22, 2015
1 parent c9baa74 commit 11cdf53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ D is complex multi-paradigm programming language.
В тоже время, если Вы знаете С, чтобы начать использовать D потребуется
всего навсего посмотреть несколько примеров.

D is complex multi-paradigm programming language. At the same time, if you know С programming language, to start using D you just need to look through some examples.

Hellow Wolrd!
~~~~~~~~~~~~~~

Expand All @@ -19,6 +21,7 @@ The following program prints "Hello, World!" to the standard output.


D `doesn't have a preprocessor <http://dlang.org/pretod.html>`_.

Use ``import core.stdc.MODULE;`` construction to import ``MODULE`` from `C Standard library`_.

.. literalinclude:: ../../examples/helloworld1.d
Expand All @@ -31,15 +34,15 @@ Module ``core.stdc.stdio`` contains the ``puts`` prototype:
extern(C) @system nothrow @nogc int puts(in char* s);
Common D "Hello, World!" program based on Phobos_ looks simpler:
Common D "Hello, World!" program based on Phobos_ looks more simple:

.. literalinclude:: ../../examples/helloworld2.d
:language: d
:tab-width: 4

Phobos is the standard runtime library that comes with the D language compiler.

.. seealso:: A collection of common C techniques, and how to do the corresponding task in D can be found `here <http://dlang.org/ctod.html>`_. However most of them can be implemented in C style.
.. seealso:: To find a collection of common C techniques, and to find out how to do the corresponding task in D click `here <http://dlang.org/ctod.html>`_. However most of them can be implemented in C style.

.. _D: http://dlang.org
.. _C Standard library: http://www.cplusplus.com/reference/clibrary/
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld1.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import core.stdc.stdio;

// ends with null!
// terminates with a null character
immutable char[] nullTerminatedStr = "Hello, World!\0";

int main()
Expand Down

0 comments on commit 11cdf53

Please sign in to comment.