what is the Forward Rendering right technique

hi,
i’m doing some work with multiple lights but i had a doubt: forward rendering should be done in the shader or in the cpp program i mean my for loop to sum different lights should be in a shader or in my cpp program?
thanks advance