Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Re: Problem with RMS structures in DEC C?
  1995-06-29  4:00 Problem with RMS structures in DEC C? P A Keller
@ 1995-06-29  4:00 ` Carl J Lydick
  1995-06-29  4:00 ` Bruce Milton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Carl J Lydick @ 1995-06-29  4:00 UTC (permalink / raw)


In article <DAxxAM.B7r@bath.ac.uk>, bsspak@bath.ac.uk (P A Keller) writes:
=Hi everyone. Can anyone explain why the following minimal code won't
=compile without error under DEC C?

It's not giving you an error, it's giving you a warning.

=VAX C is fine, as well as DEC C with the
=/STANDARD=VAXC option. As far as I can see, there is nothing here which
=conflicts with the example in the DEC C documentation, or am I just being
=dim?
=
=#include <rms.h> 
=
=struct FAB infab; 
=struct XABFHC inxab; 
=
=void func (void) { 
=
=   infab = cc$rms_fab; 
=   inxab = cc$rms_xabfhc; 
=   infab.fab$l_xab = &inxab; 
=}
=
=produces
=
=   infab.fab$l_xab = &inxab; 
=....^ 
=%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value
="&inxab" is "struct xabfhcdef", which is not compatible with "char". 
=at line number 10 in file DKA100:[USERS.PETER.CIF]RMS.C;5 

Well, as the error message tells you, you've got a pointer mismatch.  The
compiler is warning you about that.  If you don't want the warning, you've got
to let the compiler know that you know there's a mismatch, but want to make th
assignment anyway.  The way to do that is by casting the reference to the
pointer to the XAB:

#include <rms.h> 

struct FAB infab; 
struct XABFHC inxab; 

void func (void) { 

   infab = cc$rms_fab; 
   inxab = cc$rms_xabfhc; 
   infab.fab$l_xab = (char *) &inxab; 
}
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.



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

* Re: Problem with RMS structures in DEC C?
  1995-06-29  4:00 Problem with RMS structures in DEC C? P A Keller
  1995-06-29  4:00 ` Carl J Lydick
@ 1995-06-29  4:00 ` Bruce Milton
  1995-06-30  4:00 ` David Claude Brown
  1995-07-03  4:00 ` P A Keller
  3 siblings, 0 replies; 8+ messages in thread
From: Bruce Milton @ 1995-06-29  4:00 UTC (permalink / raw)


In article <DAxxAM.B7r@bath.ac.uk>, bsspak@bath.ac.uk (P A Keller) wrote:
>Hi everyone. Can anyone explain why the following minimal code won't
>compile without error under DEC C? VAX C is fine, as well as DEC C with the
>/STANDARD=VAXC option. As far as I can see, there is nothing here which
>conflicts with the example in the DEC C documentation, or am I just being
>dim?
>
>Thanks,
>Peter.
>
>
>#include <rms.h> 
>
>struct FAB infab; 
>struct XABFHC inxab; 
>
>void func (void) { 
>
>   infab = cc$rms_fab; 
>   inxab = cc$rms_xabfhc; 
>   infab.fab$l_xab = &inxab; 
>}
>
>produces
>
>   infab.fab$l_xab = &inxab; 
>....^ 
>%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer 
value
>"&inxab" is "struct xabfhcdef", which is not compatible with "char". 
>at line number 10 in file DKA100:[USERS.PETER.CIF]RMS.C;5 
>
>The compiler is DEC C V4.0-000 under OpenVMS AXP V6.1
>
>========================================================================
>Peter Keller.            \ 
>Dept. of Biology and      \ "It is a pity that people are being killed
>    Biochemistry,          \  by my guns"
>University of Bath,         \ 
>Bath, BA2 7AY, UK.           \          --- Mikhail Kalashnikov
>------------------------------\-----------------------------------------
>Tel. (+44/0)1225 826826 x 4302 | Email: P.A.Keller@bath.ac.uk (Internet)
>Fax. (+44/0)1225 826449        |   P.A.Keller%bath.ac.uk@UKACRL (BITNET)
>========================================================================


I'm working with a similar type of DEC structure and this might fix it
by infab.fab$l_xab = ( char * )&inxab.

FWIW

 

Bruce Milton
I/T Consultant
Equitable Life of Canada
bmilton@hookup.net

Disclaimer - These options are strictly my own and have no reflection
             on my company.

*********************************************
Imagination is more important than knowledge.
- Albert Einstein
*********************************************



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

* Problem with RMS structures in DEC C?
@ 1995-06-29  4:00 P A Keller
  1995-06-29  4:00 ` Carl J Lydick
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: P A Keller @ 1995-06-29  4:00 UTC (permalink / raw)


Hi everyone. Can anyone explain why the following minimal code won't
compile without error under DEC C? VAX C is fine, as well as DEC C with the
/STANDARD=VAXC option. As far as I can see, there is nothing here which
conflicts with the example in the DEC C documentation, or am I just being
dim?

Thanks,
Peter.


#include <rms.h> 

struct FAB infab; 
struct XABFHC inxab; 

void func (void) { 

   infab = cc$rms_fab; 
   inxab = cc$rms_xabfhc; 
   infab.fab$l_xab = &inxab; 
}

produces

   infab.fab$l_xab = &inxab; 
...^ 
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value
"&inxab" is "struct xabfhcdef", which is not compatible with "char". 
at line number 10 in file DKA100:[USERS.PETER.CIF]RMS.C;5 

The compiler is DEC C V4.0-000 under OpenVMS AXP V6.1

========================================================================
Peter Keller.            \ 
Dept. of Biology and      \ "It is a pity that people are being killed
    Biochemistry,          \  by my guns"
University of Bath,         \ 
Bath, BA2 7AY, UK.           \          --- Mikhail Kalashnikov
------------------------------\-----------------------------------------
Tel. (+44/0)1225 826826 x 4302 | Email: P.A.Keller@bath.ac.uk (Internet)
Fax. (+44/0)1225 826449        |   P.A.Keller%bath.ac.uk@UKACRL (BITNET)
========================================================================



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

* Re: Problem with RMS structures in DEC C?
  1995-06-29  4:00 Problem with RMS structures in DEC C? P A Keller
  1995-06-29  4:00 ` Carl J Lydick
  1995-06-29  4:00 ` Bruce Milton
@ 1995-06-30  4:00 ` David Claude Brown
  1995-06-30  4:00   ` Carl J Lydick
  1995-07-03  4:00 ` P A Keller
  3 siblings, 1 reply; 8+ messages in thread
From: David Claude Brown @ 1995-06-30  4:00 UTC (permalink / raw)


In article <DAxxAM.B7r@bath.ac.uk> bsspak@bath.ac.uk (P A Keller) writes:
>Hi everyone. Can anyone explain why the following minimal code won't
>compile without error under DEC C? VAX C is fine, as well as DEC C with the
>/STANDARD=VAXC option. As far as I can see, there is nothing here which
>conflicts with the example in the DEC C documentation, or am I just being
>dim?
[snip of hugely DEC-specific dollop of code]

This is the wrong newsgroup.  Post to a VMS specific one.

Claude.

P.S. Free advice: forget all about VAX-C as it is total crap. Use DEC-C, and
make sure you turn on all the luverly warnings that DEC-C provides.

P.P.S. You are probably doing this already. Keep doing it.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 vv    vv       David Claude Brown
 ||----||  *    brown@falam.ch
 ||     | /
 /\------/
(oo)
(~~)



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

* Re: Problem with RMS structures in DEC C?
  1995-06-30  4:00 ` David Claude Brown
@ 1995-06-30  4:00   ` Carl J Lydick
  0 siblings, 0 replies; 8+ messages in thread
From: Carl J Lydick @ 1995-06-30  4:00 UTC (permalink / raw)


In article <brown.82.00090A29@falam.ch>, brown@falam.ch (David Claude Brown) writes:
=In article <DAxxAM.B7r@bath.ac.uk> bsspak@bath.ac.uk (P A Keller) writes:
=>Hi everyone. Can anyone explain why the following minimal code won't
=>compile without error under DEC C? VAX C is fine, as well as DEC C with the
=>/STANDARD=VAXC option. As far as I can see, there is nothing here which
=>conflicts with the example in the DEC C documentation, or am I just being
=>dim?
=[snip of hugely DEC-specific dollop of code]
=
=This is the wrong newsgroup.  Post to a VMS specific one.

First of all, he posted to three newsgroups (as did you); comp.lang.c was the
only one of the three that was not DEC-specific.  Second, the problem was NOT
VMS-specific. It was a failure to explicitly cast a pointer reference.  Anybody
at all fluent in C should have noticed that immediately.
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.



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

* Re: Problem with RMS structures in DEC C?
  1995-06-29  4:00 Problem with RMS structures in DEC C? P A Keller
                   ` (2 preceding siblings ...)
  1995-06-30  4:00 ` David Claude Brown
@ 1995-07-03  4:00 ` P A Keller
  1995-07-05  4:00   ` Hein RMS van den Heuvel
  1995-07-06  4:00   ` Ken Cowan
  3 siblings, 2 replies; 8+ messages in thread
From: P A Keller @ 1995-07-03  4:00 UTC (permalink / raw)



Many thanks to everyone who responded to my origial query. It seems that
the problem stems from the fact that the header files have a long history,
and haven't been updated properly. I wonder if anyone at DEC has actually
tried compiling the example in the DEC C documentation under DEC C?

I was reluctant to take the easy option, and just put in a cast which shut
up the compilers which I have access to, since the code which I am working
on will have to compile on a wide variety of systems. 

Thanks again - I have found some of the comments very informative.
Peter.

========================================================================
Peter Keller.            \ 
Dept. of Biology and      \ "Not even the greatest nonsense is beyond
    Biochemistry,          \  the reach of human invention."
University of Bath,         \ 
Bath, BA2 7AY, UK.           \          --- Ryszard Kapuscinski
------------------------------\-----------------------------------------
Tel. (+44/0)1225 826826 x 4302 | Email: P.A.Keller@bath.ac.uk (Internet)
Fax. (+44/0)1225 826449        |   P.A.Keller%bath.ac.uk@UKACRL (BITNET)
========================================================================



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

* Re: Problem with RMS structures in DEC C?
  1995-07-03  4:00 ` P A Keller
@ 1995-07-05  4:00   ` Hein RMS van den Heuvel
  1995-07-06  4:00   ` Ken Cowan
  1 sibling, 0 replies; 8+ messages in thread
From: Hein RMS van den Heuvel @ 1995-07-05  4:00 UTC (permalink / raw)



In article <DB55Fn.5Du@bath.ac.uk>, bsspak@bath.ac.uk (P A Keller) writes...
> 
>Many thanks to everyone who responded to my origial query. It seems that
>the problem stems from the fact that the header files have a long history,
>and haven't been updated properly. I wonder if anyone at DEC has actually
>tried compiling the example in the DEC C documentation under DEC C?

Haven't tried the examples from the DEC C but did make sure to try 
the Freeware source I submitted. One of those was an example from
the RMS doc (show_roots) and there I used (void *). Unfortunatly 
the RMS doc was already printed by then and they never got fixed.

IMHO RAB$L_RBF, UBF, and KBF should have all been declared void *
as they are just that... pointers to something undefined, not char.

For FAB$L_XAB and RAB$L_XAB and XAB$L_NXT I kinda like Jerry's idea
of an empty XAB type to point to. That's rather readable.

Personally, I go with Pat Rankin though and cast to (void *).

Some day I'll check with buddy KC whether we can get this fixed properly
in the C text Libraries (without breaking existing code).

Hope this helps,		+--------------------------------------+
Hein van den Heuvel, Digital.	| All opinions expressed are mine, and |
  "Makers of VMS and other	| may not reflect those of my employer |
   fine Operating Systems."	+--------------------------------------+



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

* Re: Problem with RMS structures in DEC C?
  1995-07-03  4:00 ` P A Keller
  1995-07-05  4:00   ` Hein RMS van den Heuvel
@ 1995-07-06  4:00   ` Ken Cowan
  1 sibling, 0 replies; 8+ messages in thread
From: Ken Cowan @ 1995-07-06  4:00 UTC (permalink / raw)



In article <DB55Fn.5Du@bath.ac.uk>, bsspak@bath.ac.uk (P A Keller) writes:
|>
|>Many thanks to everyone who responded to my origial query. It seems that
|>the problem stems from the fact that the header files have a long history,
|>and haven't been updated properly. I wonder if anyone at DEC has actually
|>tried compiling the example in the DEC C documentation under DEC C?
|>
|>I was reluctant to take the easy option, and just put in a cast which shut
|>up the compilers which I have access to, since the code which I am working
|>on will have to compile on a wide variety of systems. 
|>
|>Thanks again - I have found some of the comments very informative.
|>Peter.
|>
|>========================================================================
|>Peter Keller.            \ 
|>Dept. of Biology and      \ "Not even the greatest nonsense is beyond
|>    Biochemistry,          \  the reach of human invention."
|>University of Bath,         \ 
|>Bath, BA2 7AY, UK.           \          --- Ryszard Kapuscinski
|>------------------------------\-----------------------------------------
|>Tel. (+44/0)1225 826826 x 4302 | Email: P.A.Keller@bath.ac.uk (Internet)
|>Fax. (+44/0)1225 826449        |   P.A.Keller%bath.ac.uk@UKACRL (BITNET)
|>========================================================================
|>

Which example doesn't compile?  

BTW, we're not planning to change the definition of fab.h.  It'd
be an incompatible change.  Consider the program below.  For
the call     bar( &my_a.f2 ); I get a compiler warning:


    bar( &my_a.f2 );
...^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "
&my_a.f2" is "Pointer to void", which is not compatible with "Pointer to char".
at line number 20 in file WKD$:[LCRTL]A.C;21


--#include <stdlib.h>

struct a {
    char *f1;
    void *f2;
};

void bar( char **x )
{
    *x = (char *)malloc( 14 );
    return;

}

main()
{
    struct a my_a;

    bar( &my_a.f1 );
    bar( &my_a.f2 );
}

 
Ken Cowan, ZK2-3/Q8				cowan@rtl.enet.dec.com
Digital Equipment Corporation			decwrl!rtl!cowan
110 Spit Brook Rd,
Nashua, NH 03062



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

end of thread, other threads:[~1995-07-06  4:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-06-29  4:00 Problem with RMS structures in DEC C? P A Keller
1995-06-29  4:00 ` Carl J Lydick
1995-06-29  4:00 ` Bruce Milton
1995-06-30  4:00 ` David Claude Brown
1995-06-30  4:00   ` Carl J Lydick
1995-07-03  4:00 ` P A Keller
1995-07-05  4:00   ` Hein RMS van den Heuvel
1995-07-06  4:00   ` Ken Cowan

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