#prog #go
Вот эта программа на Go не компилируется:
So much for "a simple language" and "fast compiler".
Вот эта программа на 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".
go.dev
Go Playground - The Go Programming Language
🤔11😭6👎1🔥1😁1
#prog #cpp #rust #article
Rust vs C++ Formatting
В статье, к сожалению, есть техническая неточность: в качестве одного из примеров кода на Rust приводится
Rust vs C++ Formatting
В статье, к сожалению, есть техническая неточность: в качестве одного из примеров кода на Rust приводится
println!("Point is at (x={p.x}, y={p.y}, z={p.z})");
, что в Rust в текущей версии не работает.Barry’s C++ Blog
Rust vs C++ Formatting
In Rust, if I want to print some 32-bit unsigned value in hex, with the leading 0x, padded out with zeros, I would write that as:
Neural Machine
Я не хочу просыпаться утром
Тебе не придётся просыпаться утром, если ты не будешь спать всю ночь
❤3
Forwarded from я что-то �� и всё ����
🔁 Developer Memes
"PHP as a C preprocessor"
submitted by asdvasdvasd
https://reddit.com/r/ProgrammerHumor/comments/zxalmh/php_as_a_c_preprocessor/
"PHP as a C preprocessor"
submitted by asdvasdvasd
https://reddit.com/r/ProgrammerHumor/comments/zxalmh/php_as_a_c_preprocessor/
👍16🤯4
Когда плюсовик переучивается на фронтендера, он по привычке вместо iframe пишет ifndrame
💩8👍3
#prog #rust
А технически в 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.
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.
Quick-Lint-Js
Is coding in Rust as bad as in C++?
A practical comparison of build and test speed between C++ and Rust.
😢6🔥1