[Info-vax] net: device (Re: C compiler snag)
Craig A. Berry
craigberry at nospam.mac.com
Fri May 21 15:30:22 EDT 2021
On 5/21/21 12:42 PM, Simon Clubley wrote:
> There is a problem when you use net/
> within an include statement. The following code compiles: !!!
>
> ---------------------------------------------------------------------------
> $ type nettest.c
> #include <stdio.h>
> #include <net/does_not_exist.h>
>
> int main(int argc, char *argv[])
> {
> printf("Testing net include\n");
> return 0;
> }
> $ cc nettest.c
> ---------------------------------------------------------------------------
Bug or feature I don't know, but again it seems to have nothing to do
with the compiler. Opening a non-existent file on the net: device
returns success. What you expect from opening a non-existent file:
$ perl -e "open my $f, '<', 'nosuchfile.dat' or die $^E;"
%RMS-E-FNF, file not found at -e line 1.
%SYSTEM-F-ABORT, abort
What you get when you prepend "net:" to the filename:
$ perl -e "open my $f, '<', 'net:nosuchfile.dat' or die $^E;"
$ show symbol $status
$STATUS == "%X00000001"
Note that you can't reproduce this with DCL:
$ open f net:nosuchfile.dat
%DCL-E-INVRFM, invalid record format for record I/O - file not opened
So the compiler is just converting net/does_not_exist.h to VMS syntax
net:does_not_exist.h and getting a successful open but nothing happens
when you read from it (except EOF I guess). The filename portion
doesn't matter and seems to be ignored. As far as I can tell, the
behavior is identical to that of _NLA0:.
The compiler could also be led astray by:
#include "nl/foo.h"
More information about the Info-vax
mailing list