As long as they are on a balanced diet, it is not needed. Many people give cat or dog food to either save money on feed costs or to supplement. Cat food is a very high protein diet. Most are 34% or more and typically have meat protein as the main source. It can be given as a treat when ducks are molting to give them a little extra for feather growing. Cat food should not represent more than 10% of the diet (according to Storey's Guide). Dog food, in my opinion, would not be as great of a boon as it is usually grain, not meat based.
I have tried giving cat food to my ducks in the past and they never ate it.
I did look into it and compared costs with using it as a protein source and buying quality cat food and mixing it with grains would cost the same as buying poultry grower here.