Viet's Blog

Safety

Safer C++ By Handling Function Result

  • May 12, 2018
  • POST
Overview Despite best efforts to train, educate, warn developers to always capture and handle function results, one still can manage to forget and get burned in the process. Let’s say you have this piece of code that deals with critical process: int critical_func() { return 1234; } It’s far too common for folks to use critical_func() in this manner: int use_critical_func() { critical_func(); return 0; } The values returned from critical_func() could mean anything: Cannot connect to a service, balance is empty, rocket is faulty, … Failure to capture and act based on those return values could result in any undefined/undesired behaviour: Memory leak, crash, silent failures, … Let’s see how we can enforce developers to use return value from mission critical functions.
LATESTS
Make Grub Font Size Bigger
  • Sep 22, 2019
  • POST
Endianness Agnostic ntoh
  • Jun 22, 2019
  • POST
Upcoming Posts
  • Jun 15, 2019
  • POST
Taming Elementary OS
  • May 11, 2019
  • POST
Fix Wifi for Ubuntu on Microsoft Surface
  • May 11, 2019
  • POST
Endianness Detection the Hard Way
  • Jun 17, 2018
  • POST
OCaml Packaging With Topkg and OPAM
  • May 28, 2018
  • POST
Safer C++ By Handling Function Result
  • May 12, 2018
  • POST
P2P Browsing Web With Beaker and Dat
  • Mar 31, 2018
  • POST
Edit and Annotate PDF
  • Mar 30, 2018
  • POST
CATEGORIES
TAGS
  • dev
  • tips
  • ubuntu
  • hugo
  • blog
  • c++
  • config
  • git
  • security
  • social-media

© Viet's Blog

Powered by Hugo.

Robust designed by Daisuke Tsuji.