Closed ghost closed 4 years ago
(Just FYI I've been able to get a basic echo server working well enough to encourage me to tighten everything up a bit. Thanks for all the help so far!)
In this case (the value returned by a function), INTEGER and SHORTINT mean very much the same thing. I'll add SHORTINT as a possibility just for tidiness, with an implicit truncation of the actual result.
These are not really "internal compiler errors" but implementation restrictions that are detected during code generation. The proper solution would be to add checks to the semantic analysis phase and produce a proper error message -- but that would require duplicating the list of ad-hoc cases, and this language extension is anyway "for experts only".
You've no doubt worked out that INTEGER is 4 bytes in OBC, SHORTINT is 2 bytes, and LONGINT is 8 bytes. So, unlike the ETH compilers, it's rarely necessary to use LONGINT for anything.
Received the infamous...
...while compiling...
PROCEDURE Socket*(domain, type, protocol: INTEGER):SHORTINT IS "socket";
...which admittedly is incorrect from what I can tell but I thought I'd bring it to your attention in case it was an edge case bug or you preferred a different error message. (I'm doing a straight port of some VOC compiler socket code to get everything working and it seems the return value is SHORTINT based on that compiler's default settings and the code provided.)
obc -v
.