Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* reserved word "readonly" in DEC C
@ 1999-02-21  5:00 Tim Mooney
  1999-02-22  5:00 ` Jeff Sullivan
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Mooney @ 1999-02-21  5:00 UTC (permalink / raw)


Is the token `readonly' a reserved word in the system C compiler under Digital
Unix 4.0d?

Consider the example code:

#include <stdio.h>
#include <sys/types.h>

struct example {
	int foo;
	int	readonly;
};

int main(int argc, char *argv[])
{
	struct example bar;

	bar.foo = 0;
	bar.readonly = 0;
}


If I compile with `-std1', it compiles.  If I try with `-std', I get the
errors:

cc: Error: foo.c, line 7: Invalid declarator.
        int     readonly;
----------------^
cc: Error: foo.c, line 15: Identifier expected but not found.
        bar.readonly = 0;
------------^


This leads me to believe that `readonly' is a reserved word when the compiler
is in "extended" mode.  Is that correct?  Is this documented somewhere?
Is there any way (a #pragma, perhaps) to leave the compiler in "extended" mode,
but turn off the recognition of `readonly' as a token?  It's causing me minor
problems with some OpenSource software that uses `readonly' as a struct member
in several spots.  It's more work to make the code compile in strict mode
than it is to actually change all references to that member to be
`is_readonly', but I was just wondering if the behavior I'm seeing is expected,
and/or documented.

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J1, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-02-23  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-02-21  5:00 reserved word "readonly" in DEC C Tim Mooney
1999-02-22  5:00 ` Jeff Sullivan
1999-02-22  5:00   ` Tim Mooney
1999-02-23  5:00     ` John Parks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox