Typical C++, But Why?

As much as I like new cool C++ features, I’m a big fan of small habits like this video provides that can easily be applied to a codebase that I everyday sees. And with no surprise, I’ve seen all of those problems in our codebase :P

Add Image Gallery for the All Images in Markdown Post

Add Image Gallery for the All Images in Markdown Post

Recently, I got a question asking about the functionality to make image pop up so viewer can have a better look at it. I’m not sure what is the common name of the functionality (popup image? image gallery?), but I happens to have thought about the same feature long time ago, but never started implementation. So I thought this would be the good time to start it!
And it took whole friday night because I didn’t know that element.src and element.getAttribute(src) returns different thing

Memory Order에 관한 짧고 굵은 설명

이번에 M1에서만 발생하는 concurrency issue를 접하고 버그를 해결하는 과정에서 애매하게 알고 있던 memory order에 대해 정확히 짚고 넘어갈 수 있는 시간을 가질 수 있어 짧게 해당 내용을 남깁니다.

TL;DR

Fact of Life

Relaxed는 함부로 쓰지 맙시다.
Relaxed는 명령어 재배치/최적화에 관한 어떠한 보장도 해주지 않습니다.
컴파일러가 보장해주는 유일한 사실은 Relaxed를 사용하는 atomic operation은 atomic 하다는 것입니다.

Rustlings Topic: Conversions

Rust offers a multitude of ways to convert a value of a given type into another type.
The simplest form of type conversion is a type cast expression. It is denoted with the binary operator as.
For instance, println!("{}", 1 + 1.0); would not compile, since 1 is an integer while 1.0 is a float. However, println!("{}", 1 as f32 + 1.0) should compile. The exercise using_as tries to cover this.

Rust also offers traits that facilitate type conversions upon implementation. These traits can be found under the convert module. The traits are the following:

  • From and Into covered in from_into
  • TryFrom and TryInto covered in try_from_into
  • AsRef and AsMut covered in as_ref_mutld both compile and run without panicking. These should be the main ways within the standard library to convert data into your desired types.

You may find solution code for the topic from my repo.

Pagination