Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: mooney@dogbert.cc.ndsu.NoDak.edu (Tim Mooney)
Subject: reserved word "readonly" in DEC C
Date: 1999/02/21	[thread overview]
Message-ID: <7anks0$mju$1@node2.nodak.edu> (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



             reply	other threads:[~1999-02-21  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-21  5:00 Tim Mooney [this message]
1999-02-22  5:00 ` reserved word "readonly" in DEC C Jeff Sullivan
1999-02-22  5:00   ` Tim Mooney
1999-02-23  5:00     ` John Parks
read-only archive

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