Let $f:[a,b] \rightarrow \mathbb{R}$ be a continuous function such that it is differentiable everywhere unless in a null set $S$. Suppose that there is a function $g$, which is bounded and Riemann integrable in $[a,b]$, such that $g(x) = f'(x)$ for every $x\in [a,b] -S$. Then,
$$ f(b)-f(a) = \int^b_a g $$
is true? If it is false, provide a counterexample and consider the case in which we switch "null set" by "countable set". In this case, it will be true? If not, provides a counterexample. I know that it would be true if we have finite set instead of null set.
Remark: I am asking this question because I am studying a Brazilian book about Fourier Analysis ("Análise de fourier e equações diferenciais parcias" whose author is Djairo), in which he just uses Riemann integral and uses many times integration by parts. However, he just say "let $f$ be continuous in a closed and bounded interval such that $f'$ is integrable in the same interval" and then he uses integration by parts (the other function is $\cos$ or $\sin$ usually). And he doesn't define which he means by the "derivative" of a function, because if $f$ is differentiable everywhere, it would redundant to say that it is continuous. Would it be differentiable everywhere unless in a null set, countable set, finite set? Idk. This is why i am asking how far I can push the fundamental theorem of calculus, which is used to prove integration by parts.
Edits: Thanks for the comments, the case in which $S$ is a null set is already solved. It's false. The counterexample is the Cantor function. It remains the case in which $S$ is countable.
Here: "A Fundamental Theorem of Calculus" there's a similar problem, but I m not sure if it is equivalent. Anyway, I would really appreciate if my problem were solved not using Lebesgue theory, which i haven't studied yet.
I had to fix the statement of the problem because it was wrong, as pointed out in the comments. Originally, i thought that it was enough that $f$ was differentiable in $[a,b]-S$ and one can extend $f'$ in any way, but then $\int_a^b f'$ will not exist necessarily, and we won't obviously have $ f(b)-f(a) = \int^b_a f'$.