-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Me too, I think because then someone would ask, "Why not DeviceNET" and
I was going to ask "Why not SNA?"
then we'd add that to C and next thing you know, C would only be able to
run on hosted implementations.
Accepted wisdom aside, why /couldn't/ C (in a future incarnation) define
a 'networking' interface in the same flavour as it now provides a file
access interface? The same caveats and exceptions for hosted vs unhosted
that currently apply to the stdio library could be applied to this
hypothetical stdnet library.
To take it a step further, how about abstracting network access into the
implementation of the stdio library? This way, the language wouldn't
have to change to provide networking features. To show what I mean, take
the following example program:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *data;
if ((data = fopen("data","w")) != NULL)
fprintf(data,"Hello, World\n");
fclose(data);
return EXIT_SUCCESS;
}
The above program /obviously/ writes to a file called "data". Now, look
at this minor modification:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *data;
if ((data = fopen("tcp:127.0.0.1:9","w")) != NULL)
fprintf(data,"Hello, World\n");
fclose(data);
return EXIT_SUCCESS;
}
Does the above program write to the file called "tcp:127.0.0.1:9", or
does it establish a TCP connection with the local discard service and
send it some data? Does it matter, wrt ISO C?
- --
Lew Pitcher, IT Consultant, Enterprise Application Architecture
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFA9DjmagVFX4UWr64RAo83AJ48OYnhgsXXDkllL1ssype0VxMBVwCgqGyU
oZScRtcwsOC0yBB5H/kp8aE=
=5DqQ
-----END PGP SIGNATURE-----