Newsgroups: comp.unix.aix Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!mit-eddie!bloom-beacon!world!madd From: madd@world.std.com (jim frost) Subject: Re: changing the console; alloca missing from 9021? Message-ID: <1990Aug7.022021.20827@world.std.com> Organization: Saber Software References: <61875@bu.edu.bu.edu> <3017@awdprime.UUCP> Date: Tue, 7 Aug 90 02:20:21 GMT kent@opus.austin.ibm.com (Kent Malave') writes: >> Also, it looks like alloca isn't in libbsd.a or libc.a. Was this just an >> oversight in this release? If this is true, is there someone who can give >> me a copy (hello IBM?) >> > You may want to look in /usr/lpp/bos. In this directory there are > to very good articles on AIX and BSD differences in system administration > (file bsdadm) and porting of code (file bsdport). The bsdport file is pretty good, if you're porting bsd code I recommend it. There are still some gotchas, though. First gotcha is you need to include #pragma alloca to get alloca. It's pretty hard to build a function that does alloca on a lot of machines (the rios is one of them) so it's done inline. It also uses an extra register because it keeps both a stack pointer (r1) and a frame pointer (r31) so you get moderately less efficient code. Second gotcha is that if you're using /lib/cpp as recommended in bsdport, #pragma alloca will cause it to internal error. You can do this in one line: % cat > foo.c #pragma alloca ^D % cc -B/lib/ foo.c # bsdcc from bsdport does this [some number] Internal error -- please contact your IBM representative. I might be wrong about the -B flag, I don't have the documentation handy and it might be some other letter. The internal cpp doesn't internal error. It does, however, barf on at-signs (@) which is hardly nice behavior. On the up-side, compatibility with BSD code seems very high. About the only problem I had on the stuff I have ported was that sigcontext (mstsave or whatever on the rios) is radically different and that compiling in BSD mode is pretty slow. Happy hacking, jim frost saber software jimf@saber.com