• 2 Posts
  • 115 Comments
Joined 2 years ago
cake
Cake day: July 3rd, 2023

help-circle











  • printf is superior and more concise, and snprintf is practically the only C string manipulation function that is not painful to use.

    Try to print a 32-bit unsigned int as hexadecimal number of exactly 8 digits, using cout. You can do std::hex and std::setw(8) and std::setfill('0') and don’t forget to use std::dec afterwards, or you can just, you know, printf("%08x") like a sane person.

    Just don’t forget to use -Werror=format but that is the default option on many compilers today.

    C++23 now includes std::print which is exactly like printf but better, so the whole argument is over.





  • Home-made tvorog is just cottage cheese without the temperature or fermentation control, you just let the fresh milk get sour and curd on it’s own then strain the curd. So it’s more acidic and less uniform.

    The commercialy produced tvorog is made using the skimmed milk after most of the fat is extracted to make butter, so it’s like 1% fat and 10% protein. Cottage cheese keeps the fat content.

    You can ‘fix’ tvorog to be more like cottage cheese by boiling it with fresh milk, it will remove much of the sourness and add back fat content.