I'm not sure if this is POSIX, but if you program accepts positional arguments, in bash you can do eg.:
diff <(somecommand) <(someothercommand) and the shell will replace these with /dev/fd/<n>, allowing you to also accept standard input without relying on hardcoded file descriptors.