bartc <b...@freeuk.com> writes: > On 06/10/2017 14:35, Paul Moore wrote: >> On 6 October 2017 at 13:56, bartc <b...@freeuk.com> wrote: >>> If you don't like the word 'crude', try 'lazy'. Take this example of the gcc >>> C compiler: >>> >>> > gcc -E program.c >>> >>> This preprocesses the code and shows the result. Typical programs will have >>> many thousands of lines of output, but it just dumps it to the console. You >>> /have/ to use '>' to use it practically (Windows doesn't really have a >>> working '|' system.)
Does the Windows version of gcc not support the -o file option? >> No you don't. Ignoring the fact that "windows doesn't really have a >> working '|' system" (which is an oversimplification, by the way) the >> following all work: >> >> Python: >> data = subprocess.check_output(["gcc", "-E", "program.c"]) >> Powershell: >> $x = (gcc -E program.c) >> cmd: >> for /f %i in ('gcc -E program.c') do ... >> >> If gcc -E wrote its output to a file, you'd have to read that file, >> manage the process of deleting it after use (and handle possible >> deletion of it if an error occurred), etc. > > But if I use the -S option (show assembly listing) that DOES output to > a file (program.s). And a good system lets you alter that. How many labels are generated for some code? Let's see: gcc -S -o /dev/stdout t.c | grep -c '^\.L' Now gcc also permits -o - (it's a common Unix convention) but you can almost always get round less helpful programs using /dev/sdout. <snip> -- Ben. -- https://mail.python.org/mailman/listinfo/python-list