Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: @XSStringManolo en 19 Mayo 2019, 05:42 am



Título: Manual errores comunes C++
Publicado por: @XSStringManolo en 19 Mayo 2019, 05:42 am
Estaba buscando manuales de desarrollo de malware y me encontre esto:
https://tfetimes.com/wp-content/uploads/2015/04/hack.pdf
No tiene nada que ver pero lo estoy leyendo y me parece muy util con "hacks" para mejorar casos concretos de errores de programación comunes. Son en total 135 "hacks".

Un ejemplo:

Hack 52: Know When to Use _exit
The Problem: You are forking off a process and do some work and then
exit, without doing anything to the I/O buffers in the process. You can't use the
exit function because of the problems described in Hack 51.
The Hack: Use _exit.
The _exit function stops your program. That's all it does, stop the
program. It does not pass go, it does not collect $200. But more importantly it
does not flush any I/O buffers. All that happens when you call _exit is that
your process goes away.

This is very useful when you've forked of a process that has done it's work
and needs to stop. Remember exit flushes things and can cause all sorts of
trouble with shared files. The _exit call avoids this problem.