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

* Re: reserved word "readonly" in DEC C
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Sullivan @ 1999-02-22  5:00 UTC (permalink / raw)


Yes, DEC C provides support for the storage-class modifier readonly,
which is a VAX C keyword. I found a description in section 2.11 or
the DEC C Language Reference Manual.

The fact that it was recognised as a keyword in -std mode for
the DEC C compiler in V4.0D is a feature or a bug, based on your
perspective. The feature/bug is not in the compiler for V4.0F
and later in the -std mode. Admittedly, more users considered
this a bug than a feature...

You could workaround it by adding -Dreadonly=_readonly to your
command line. This essentially is the same as doing this in the
code, prior to the use of readonly:

#define readonly _readonly

Let me know if you need more info.

Thanks,
-Jeff

-- 
Jeff Sullivan | Compaq Computer Corp  |   mailto:jps@zk3.dec.com
DEC C and C++ | Nashua, NH  ZK3-2/X29 | Jeff.Sullivan@compaq.com



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

* Re: reserved word "readonly" in DEC C
  1999-02-22  5:00 ` Jeff Sullivan
@ 1999-02-22  5:00   ` Tim Mooney
  1999-02-23  5:00     ` John Parks
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Mooney @ 1999-02-22  5:00 UTC (permalink / raw)


In article <36D1DFA5.F1CB343B@zk3.dec.com>,
Jeff Sullivan  <jps@zk3.dec.com> wrote:
> Yes, DEC C provides support for the storage-class modifier readonly,
> which is a VAX C keyword. I found a description in section 2.11 or
> the DEC C Language Reference Manual.

Hmmm... There's a manual I don't have.  I'll have to check the doc site on
the web.  Thanks for the pointer.

> The fact that it was recognised as a keyword in -std mode for
> the DEC C compiler in V4.0D is a feature or a bug, based on your
> perspective. The feature/bug is not in the compiler for V4.0F
> and later in the -std mode. Admittedly, more users considered
> this a bug than a feature...
> 
> You could workaround it by adding -Dreadonly=_readonly to your
> command line. This essentially is the same as doing this in the
> code, prior to the use of readonly:
> 
> #define readonly _readonly
> 
> Let me know if you need more info.

I don't, and thanks for the reply Jeff.  As usual, the information you've
provided is both candid and useful!  ;-)

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

* Re: reserved word "readonly" in DEC C
  1999-02-22  5:00   ` Tim Mooney
@ 1999-02-23  5:00     ` John Parks
  0 siblings, 0 replies; 4+ messages in thread
From: John Parks @ 1999-02-23  5:00 UTC (permalink / raw)
  To: Tim Mooney

[adding to Jeff's reply]

So it's been "fixed" in V4.0E and later releases.  You can upgrade the OS,
use Jeff's workaround, or rename "readonly" in your source code to avoid
the problem.  There's a fourth solution you might also want to consider.
The Tru64 UNIX development environment team is now field-testing an update
kit for certain development tools (called the "DTK" or Developers Toolkit).

The first field test update kit (DTK EFT1) contains the DEC C compiler and
installs and runs on V4.0D and V4.0E systems.  It currently provides the
following new C compiler features:

    o  parallel programming support (both the OpenMP parallel programming API

       and old-style SGI manual decomposition directives)

    o  major source_listing improvements

    o  optional dynamic array bounds checking

    o  variable length arrays, restricted pointers, initializers with
       designators, and other new C9X features

    o  significant new diagnostic controls (pragmas and command-line options)

    o  new compiler diagnostics (detection of undefined side-effects,
       unnecessary #include files, potential 64-bit gotchas, etc.)

    o  enhanced Microsoft compatibility mode (including thread local storage)

    o  significant optimization improvements (including improved utilization
       of new alpha hardware, enhanced intrinsic function support, better
loop
       transforms, etc.)

DTK EFT2 should ship soon and may also include new versions of decladebug,
the atom-based program analysis tools, and the Visual Threads package.  It
should install and run on V4.0D, V4.0E, and V4.0F.

The DTK field test kits are down-loadable from the web and simple to
install.  They do not remove access to your current tools.  And they're free
to all those with a current Tru64 UNIX development license.

If you're interested, send mail to Pat Mulvey at mulvey@zko.dec.com to
sign-up for the field test.

\John Parks


Tim Mooney wrote:

> In article <36D1DFA5.F1CB343B@zk3.dec.com>,
> Jeff Sullivan  <jps@zk3.dec.com> wrote:
> > Yes, DEC C provides support for the storage-class modifier readonly,
> > which is a VAX C keyword. I found a description in section 2.11 or
> > the DEC C Language Reference Manual.
>
> Hmmm... There's a manual I don't have.  I'll have to check the doc site on
> the web.  Thanks for the pointer.
>
> > The fact that it was recognised as a keyword in -std mode for
> > the DEC C compiler in V4.0D is a feature or a bug, based on your
> > perspective. The feature/bug is not in the compiler for V4.0F
> > and later in the -std mode. Admittedly, more users considered
> > this a bug than a feature...
> >
> > You could workaround it by adding -Dreadonly=_readonly to your
> > command line. This essentially is the same as doing this in the
> > code, prior to the use of readonly:
> >
> > #define readonly _readonly
> >
> > Let me know if you need more info.
>
> I don't, and thanks for the reply Jeff.  As usual, the information you've
> provided is both candid and useful!  ;-)
>
> 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