1.83K subscribers
3.3K photos
132 videos
15 files
3.58K links
Блог со звёздочкой.

Много репостов, немножко программирования.

Небольшое прикольное комьюнити: @decltype_chat_ptr_t
Автор: @insert_reference_here
Download Telegram
TrapsWorld
#gay
Всего один человек заполнил и выложил бинго. Непорядок 😒
#prog #go

Вот эта программа на Go не компилируется:

package main

func main() {
switch 0 {
case 1, 0:
falltrough
caes 3:
break
}
}

Компилятор выдаёт ошибку:
./prog.go:7:7: syntax error: unexpected literal 3 at end of statement

Причина? Опечатка в ключевом слове case в седьмой строчке. Но, разумеется, компилятор Go этого не скажет. И на go.dev/play этого сразу не заметишь, потому что там нет подсветки синтаксиса, причём принципиально.

So much for "a simple language" and "fast compiler".
🤔11😭6👎1🔥1😁1
#prog #cpp #rust #article

Rust vs C++ Formatting

В статье, к сожалению, есть техническая неточность: в качестве одного из примеров кода на Rust приводится

println!("Point is at (x={p.x}, y={p.y}, z={p.z})");

, что в Rust в текущей версии не работает.
Forwarded from Neural Machine
Я не хочу просыпаться утром
👍3
Neural Machine
Я не хочу просыпаться утром
Тебе не придётся просыпаться утром, если ты не будешь спать всю ночь
3
This media is not supported in your browser
VIEW IN TELEGRAM
🤔4👍1
Forwarded from DOFH - DevOps from hell
17😢4
Каждый Опенсорс Желает Зарабатывать, Грубо Стыривая Фичи
😁12👍2👎1
Forwarded from я что-то �� и всё ����
👍16🤯4
Когда плюсовик переучивается на фронтендера, он по привычке вместо iframe пишет ifndrame
💩8👍3
напоминаю
13
Как же хорошо, что на моей работе дейли всего раз в неделю ☺️
🤩9😁3👍2
Forwarded from Архонт щітпосту | #укртґ (free hugs 🐍)
👍11😁2
Forwarded from Life of Tau
каминг-аут я не люблю кетчуп
👎12👍2😐2😢1
#prog #rust

А технически в Rust можно обернуть порядок всего, что может преобразовываться в двухсторонний итератор по мутабельным ссылкам на элементы:

fn reverse<'a, Item: 'a, I>(iterable: I)
where
I: IntoIterator<Item = &'a mut Item>,
I::IntoIter: DoubleEndedIterator,
{
let mut iter = iterable.into_iter();
while let (Some(a), Some(b))
= (iter.next(), iter.next_back()) {
std::mem::swap(a, b);
}
}
😱8🥰1
#prog #cpp #rust #article

Is coding in Rust as bad as in C++?

Несмотря на провокационный заголовок, речь идёт исключительно о времени компиляции.

Conclusion

Are compilation times a problem with Rust? Yes. There are some tips and tricks to speed up builds, but I didn't find the magical order-of-magnitude improvements which would make me happy developing in Rust.

Are build times as bad with Rust as with C++? Yes. And for bigger projects, development compile times are worse with Rust than with C++, at least with my code style.

Looking at my hypotheses, I was wrong on all counts:

1. The Rust port had more lines than the C++ version, not fewer.
2. For full builds, compared to Rust, C++ builds took about the same amount of time (17k SLOC) or took less time (100k+ SLOC), not longer.
3. For incremental builds, compared to C++, Rust builds were sometimes shorter and sometimes longer (17k SLOC) or much longer (100k+ SLOC), not always longer.
😢6🔥1