This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct { | |
char *str; | |
int size; | |
int counter[256]; | |
} thread_args; | |
void* threadFunc(void *args) { | |
thread_args *params = (thread_args *) args; | |
for (int i = params->size/2; i < params->size; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Перенос по оператору, оператор в конце строки | |
if true && | |
false && | |
"asd" > "asd" { | |
// ... | |
} | |
//#2 Перенос по оператору, оператор в начале строки |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Первый параметр на одной строке с именем метода, круглые скобки примыкают к параметрам | |
abc(parameter: "asd", | |
closure: { | |
// ... | |
}) | |
//#2 Первый параметр на новой строке, закрывающая круглая скобка примыкает к параметру | |
abc( | |
parameter: "asd", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Возвращаемый тип идёт сразу за закрывающей круглой скобкой | |
func abc() -> Int { | |
//... | |
} | |
//#2 Возвращаемый тип идёт отдельной строкой | |
func abc() | |
-> Int { | |
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Круглые скобки примыкают к параметрам | |
func abc(a: String, | |
b: Int) | |
//#2 Круглые скобки не примыкают к параметрам | |
func abc( | |
a: String, | |
b: Int | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Запретить trailing closure | |
[""].filter({ ... }) | |
//#2 Запретить trailing closure для методов, возвращающих Void | |
let sortedArray = [""].sorted { ... } | |
mutableArray.sort({ ... }) | |
//#3 Разрешить trailing closure только для методов, где больше нет параметров (т.е. нет круглых скобок при вызове) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Указывам | |
let url: NSURL = FileWriter.main.fileURL | |
//#2 Не указываем | |
let url = FileWriter.main.fileURL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 Не указываем | |
service.searchWithKeyword(keyword, | |
offset: offset, | |
limit: limit, | |
completion: { result in | |
//... | |
} | |
failure: { error in | |
//... | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#1 | |
guard | |
let data = ..., | |
let image = ... | |
else { | |
//... | |
return | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Realm | |
// сущности (у Message нет ссылки на Folder) | |
class Folder: Entity { | |
var name: String? | |
var messages: [Message]? | |
//... | |
} |
OlderNewer