Pointer Trouble Right Here in Unix City

Jeff Lee jeff at gatech.CSNET
Wed May 29 03:35:30 AEST 1985


I was in the process of writing a section of code that parsed arguments
(how many times have you re-invented the wheel) and came across a problem
that I think is  bug in the C compiler, but before I become so bold to
call it that, I want to get other peoples opinions. The problem is to
allow either "-parg" or "-p arg". After fooling with it a few minutes, I
came up with this (just the relevent section is enclosed)

	if (**argv != '-')
		usage();

	switch (*(*argv + 1))
	{
		case 'd':
			*(*argv + 2) ? *argv += 2 : argv++;

			/* other processing goes here */
			break;

		case 'b':
			*(*argv + 2) ? *argv += 2 : argv++;

			/* other processing goes here */
			.
			.
			.

The problem is that I get the error messages

	warning: illegal pointer combination
	illegal types in :

when I compile it. I am turning it into if/else combinations, but it sort
of ruins the nice looking single line phrase that doesn't get in your
way. What is wrong with this ??  It happens under BRL's Berkeley 4.2 and
under their system V emulation.

	Tell me, is it me, or is it Memorex ??
-- 
Jeff Lee
CSNet:	Jeff @ GATech		ARPA:	Jeff%GATech.CSNet @ CSNet-Relay.ARPA
uucp:	...!{akgua,allegra,hplabs,ihnp4,linus,seismo,ulysses}!gatech!jeff



More information about the Comp.lang.c mailing list