warnings fixed for -Wall -Wextra -pedantic and for C++