Язык Go для С++ программистов | Participants
|
- Statistics
- Participants
- Translate into Russian
- Translation result
- 98% translated in draft. Almost done, let's finish it!
If you do not want to register an account, you can sign in with OpenID.
Go For C++ Programmers | ||
Go is a systems programming language intended to be a general-purpose systems language, like C++. These are some notes on Go for experienced C++ programmers. This document discusses the differences between Go and C++, and says little to nothing about the similarities. | Go это системный язык программирования, предназначенный быть языком общего назначения подобно С++ . Этот документ - несколько заметок для опытных программистов на С++. Будут обсуждаться различия между Go и C++, и практически ничего не говорится о схожих свойствах. | |
For a more general introduction to Go, see the Go tutorial and Effective Go. | Для общего введения в Go посмотрите пример использования Go и Effective Go. | |
For a detailed description of the Go language, see the Go spec. | Для детального описания языка Go обратитесь к спецификации Go. | |
Conceptual Differences | ||
Go does not have classes with constructors or destructors. Instead of class methods, a class inheritance hierarchy, and virtual functions, Go provides interfaces, which arediscussed in more detail below. Interfaces are also used where C++ uses templates. | В Go нет классов с конструкторами или деструкторами. Вместо методов классов, наследования и виртуальных функций в Go используются интерфейсы, которые будут рассмотрены далее. Также интерфейсы используются вместо шаблонов С++. | |
Go uses garbage collection. It is not necessary (or possible) to release memory explicitly. The garbage collection is (intended to be) incremental and highly efficient on modern processors. | Go использует автоматическую сборку мусора. Нет необходимости (возможности) освобождать память вручную. Сборка мусора инкрементальная и оптимизирована на современных процессорах. | |
Go has pointers but not pointer arithmetic. You cannot use a pointer variable to walk through the bytes of a string. | В Go есть указатели, но нет арифметики с указателями. Использование указателей для прохода по массиву символов строки запрещено. | |
Arrays in Go are first class values. When an array is used as a function parameter, the function receives a copy of the array, not a pointer to it. However, in practice functions often use slices for parameters; slices hold pointers to underlying arrays. Slices are discussed further below. | Массивы в Go передаются по значению. При передаче в функцию массива передаётся его копия, а не указатель. На практике функции часто используют срезы для параметров, срезы хранят ссылки на исходные массивы. Срезы будут рассмотрены далее. | |
Strings are provided by the language. They may not be changed once they have been created. | Строки встроены в язык. После создания их нельзя изменять. | |
Hash tables are provided by the language. They are called maps. | Хеш-таблицы также встроены в язык и называются картами. | |
Separate threads of execution, and communication channels between them, are provided by the language. This is discussed further below. | Также в язык встроено распараллеливание потоков исполнения и каналы общения между ними. Они будут рассмотрены далее. | |
Certain types (maps and channels, described further below) are passed by reference, not by value. That is, passing a map to a function does not copy the map, and if the function changes the map the change will be seen by the caller. In C++ terms, one can think of these as being reference types. | Некоторые типы (карты и каналы) передаются по ссылке, а не по значению. То есть, если в функцию передать карту и изменить её в ней, то изменится и исходный объект. В терминах С++ они являются "ссылочными" типами. | |
Go does not use header files. Instead, each source file is part of a defined package. When a package defines an object (type, constant, variable, function) with a name starting with an upper case letter, that object is visible to any other file which imports that package. | В Go не используются хедер-файлы. Каждый исходный файл находится в некотором пакете. Определения обьектов (типов, констант, переменных, функций), начинающиеся с заглавной буквы, становятся видны во всех файлах, импортирующих данный пакет. |
License: Creative Commons Attribution 3.0 License.

— кстати, чей-то вольный первод - http://netsago.org/ru/docs/1/16/ — d8