From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26517 invoked by alias); 2 May 2006 18:14:31 -0000 Received: (qmail 26508 invoked by uid 22791); 2 May 2006 18:14:31 -0000 X-Spam-Check-By: sourceware.org Received: from mail.artimi.com (HELO mail.artimi.com) (217.40.213.68) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 May 2006 18:14:29 +0000 Received: from mail.artimi.com ([192.168.1.3]) by mail.artimi.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 2 May 2006 19:14:26 +0100 Received: from rainbow ([192.168.1.165]) by mail.artimi.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 2 May 2006 19:14:28 +0100 From: "Dave Korn" To: "Thread TITTTL'd!" Subject: FW: Truncated Environment Variables? - using Cygwin + GetEnvironmentStrings() WIN32 API Date: Tue, 02 May 2006 18:14:00 -0000 Message-ID: <003301c66e14$3fb25190$a501a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Mailing-List: contact cygwin-talk-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: cygwin-talk-owner@cygwin.com Reply-To: The Cygwin-Talk Maiming List X-SW-Source: 2006-q2/txt/msg00193.txt.bz2 On 02 May 2006 16:57, Christopher Faylor wrote: > On Tue, May 02, 2006 at 03:32:44PM +0100, Dave Korn wrote: >> On 02 May 2006 15:18, Kaveh Goudarzi wrote: >>> Also I noticed that the address of environ seems always to be at >>> 0x460090 ... is it safe to assume this to always be the case? >> >> No, absolutely not. > > What he said. It's hard to believe that question would even be > seriously asked. > > cgf WTF is going on in the world of computer programming? We appear to be going backwards. When I first began coding on 8-bit single tasking micros, with rom-kernels, you could rely on the memory map being constant and everything being in the same place all the time. But that was already invalid on big iron and *nix boxen and when I moved up to 16-bit coding (Amiga mostly) the very first thing that was hammered into us with a big hammer was "Don't hardcode addresses - the memory map changes all the time and you might get loaded anywhere and your stack might be anywhere else and malloc will often return different values! You don't own the whole system any more and you have to play nice! Allocate everything and get a pointer to it and lookup stuff that can be lookedup every time! Free every resource you use so you don't starve the system!" Now everyone seems to have been thoroughly spoilt by MMUs, and assume that leaking memory and file handles is unimportant ("Oh, they'll all be cleaned up when the process exits won't they?"), and that the memory layout will be the same every single time. Gah. Even GCC dumps out huge chunks of memory full of internal data structures and pointers (precompiled header support) and expects to just be able to load it back in at the same address. Has everyone just forgotten everything we learned in the last few decades about resource management, position-independence and serialisation? cheers, DaveK -- Can't think of a witty .sigline today....