It's usually a law to announce yourself before passing from behind on a sidewalk or path; but it's not required on the road. And I'd rather not have cars honking at me every time they pass. That said, a lot of MUPpets expect the same consideration if they venture out on the road. It's hard to tell who they are ahead of time, though, and most cyclists are aware enough of their surroundings that they don't need the warning; so I don't shout, ring my bell, etc unless they look like they're about to something unpredictable; you know, lost in their own reverie and oblivious to everything else. I always give everyone plenty of room, just in case.
Last year I was chastised for not giving a warning, by someone who was riding on a wide paved shoulder. I was out almost to the center line when I passed him. Probably 15 feet of clearance. I guess I startled him.