S40, IIRC, is Symbian. It's related to the S60 that powered lots of Nokia smartphones, mostly the ones that actually work. Keeping to it and ditching the newer versions would be clever.
With a bit of googling I found this quote from a Forum Nokia champion: "Series 40 (S40) is not based on Symbian at all, but a Nokia proprietary real-time operating system. Series 40 does not allow any native (C/C++) development (with or without Qt). The primary app development for Series 40 based phones is Java (JME, J2ME, MIDP/CLDC), or Flash Lite." http://discussion.forum.nokia.com/forum/showthread.php?21666...
Here's another link: http://eve-c.org/2011/syskwyawan/