Open rkujawa opened 7 years ago
Trying to compile LinkList.c with VBCC and AmigaOS 68k target (with NDK 3.9 includes) results in:
$ vc -c LinkList.c
>#include <wchar.h>
error 248 in line 4 of "LinkList.h": file 'wchar.h' not found
1 error found!
vbccm68k -quiet "LinkList.c" -o= "/var/tmp/tmp.0.asm" -O=1 -I/opt/amiga-cross/vbcc/m68k-amigaos/include -I/opt/amiga-cross/ndk_3.9/include/include_h/ failed
Sure I'll hide it behind some #defines later today.
It is largely untested at the moment but I'm happy you're interested. I'll hammer it out.
And I love you're using the Amiga. I have several in my office.
I also have to point out that the Amiga does have a native, OS level link list. Just FYI.
Hi.
I am aware that AmigaOS has native linked lists, but then sometimes I'd like to be able to build the same source on an Unix-like and AmigaOS. So having OS-independent structure still helps. If I had some more time on my hands, I'd patch and provide pull request myself :P...
I also think Amiga is an awesome platform, (shameless plug) you might want to check out some of the things I've co-developed for Amiga: https://github.com/Sakura-IT .
Best regards, Radoslaw
Very cool. Yeah I'll fix it today. No worries.
@rkujawa So I will have to look at how I work with a few parts of this. 64-bit types such as long long and long double also need to be put behind flags. I am handling and updating that. The larger issue at hand is that vc, your compiler of choice, doesn't support anonymous unions. I will have to fork in order to enable that.
On the Amiga, GCC 2.95.x and SAS/C do support anonymous unions. I haven't tried several of the other Amiga compilers out there. How tied to VBCC are you? If you are sufficiently tied to it, I'll have to provide a fork of the code, which I can do, but that isn't on the top of my list of things I wish to do. That being said, if you want it, I'll provide it.
Thanks for looking into this.
I am not an expert on all the C standards but I think anonymous unions are not a part of ISO C? I suspect they are not even in C99 (or at least this is what quick google search suggests). Therefore, there is a risk that other retro platforms with not-so-modern compilers will have similar issue. Again, if you are targeting retro, then you might want to stick purely to ISO C features. Just saying. It's not that I demand it, but you might run into this problem again sooner or later.
I use VBCC in all my Amiga projects, due to following reasons:
I understand your reasoning for using VBCC. Perhaps we can have the author add support. Most compilers do support this feature.
I am specifically targeting the Amiga and Power Macintosh, pre OS X, as the two major platforms. Both support anonymous unions. While not C99 nor C89 for that matter, the feature was a popular one back then to add.
I haven't tried Aztec C but I suspect that'll work as well. If all else fails, and I'll probably do this anyhow, I'll support a named union branch as well. It makes working with the code even more of a mess and so I'd like to avoid it if possible.
I was planning on displaying tested compiler support but haven't gotten around to it yet.
Update I have put the 64-bit types and the wchar_t support behind compiler define flags to make things go for now in SAS/C. I am going to decide, likely tomorrow or the next day on how/if I want to refactor for not using anonymous unions before I add any more features.
I'll likely remove them but I'll keep you informed. The issue around removing them simply means that I will want to refactor, to some degree, the interface to the LinkList code. I have some ideas around this I just need to vet them first.
I will ask the VBCC author whether he's willing to implement anonymous unions, although I suspect it might not be a trivial change.
I didn't get to test anything yet, but I think at least some 64-bit types are supported if you use -c99 option to vc.
On a side note, I've been often using quehe.h
borrowed from NetBSD, which (among other data structures) contains linked list implementation. This seems to be working very well with purely ISO C compilers, including VBCC. The clear advantage of queue.h
is that it can work with any kind of data types in the list (as the data is encapsulated in a struct). The serious disadvantage is that API is somewhat ugly and that implementation is a macro ridden hell... that is very hard to debug. If you're interested, see here:
https://github.com/NetBSD/src/blob/trunk/sys/sys/queue.h
and the associated manual page:
http://netbsd.gw.com/cgi-bin/man-cgi?SLIST++NetBSD-current
Hello. I often hack on retro things and having a small, efficient linked list implementation would be helpful (so that I can stop reinventing the wheel). However, in the current state CLinkList can not be used on some retro environments due to dependence on wchar.h. Apparently, it is an extension to standard C library, that appeared in 1995 or so. Many older systems will not have it.