ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Воскресенье
5 мая
172165 Топик полностью
Evgeny_CD, Архитектор (11.11.2009 23:42, просмотров: 137) ответил Evgeny_CD на Ну что, мы готовы кодить на Go? "Google представил свой язык программирования" -> сайт языка -->
Go For C++ Programmers http://golang.org/doc/go_for_cpp_programmers.html
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 are discussed in more detail below. Interfaces are also used where C++ uses templates. 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 has pointers but not pointer arithmetic. You cannot use a pointer variable to walk through the bytes of a string. 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. 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 does not support implicit type conversion. Operations that mix different types require casts (called conversions in Go). Go does not support function overloading and does not support user defined operators. Go does not support const or volatile qualifiers. Go uses nil for invalid pointers, where C++ uses NULL or simply 0.