Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: BGB Newsgroups: comp.lang.java.programmer Subject: Re: Android?Why Dalvik? Date: Mon, 30 May 2011 12:46:33 -0700 Organization: albasani.net Lines: 59 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net /KKxsy9GTvcyHtnyBypCYOwIhPxEMzJ5rVcXWS4grtz/Ro1bmynO8xr72Rx8F7m/IVUx50MqriizHr2LS3wc3g== NNTP-Posting-Date: Mon, 30 May 2011 19:49:34 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="1YgcD5asCG0E/cTsJEaj7JwipuRNK95ypXN5p+NOON59daVWi0t3my7NN9UMuVnLA1ij/nxa/CzYfG9//qkFRGcMPiivurYbyGcsi/9lWibiWk5ms/mWFrQSHYCLfCiF"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:l0eXxTVwulL/hmBJDmpb668PVEY= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4742 On 5/30/2011 12:25 PM, Joshua Cranmer wrote: > On 05/30/2011 06:26 AM, BGB wrote: >> C source code generally doesn't need to change that much between one >> target and another (after all, most variations in OS and architecture >> can be trivially handled via #ifdef magic). > > I laugh at anyone who thinks this. If you do anything with a GUI, file > access beyond "open this file and read/write it", networking, > multithreading, you WILL run into nontrivial portability issues. Heck, > even porting 32-bit code to a 64-bit target of an otherwise identical > system is often nontrivial for any decently sized project. > as noted, I said "trivially handled via ifdef magic...". this means, generally: #ifdef linux Linux specific stuff... #endif #ifdef _WIN32 Windows specific stuff... #endif #ifdef MACOSX Mac specific stuff... #endif ... now, the code specific to each OS will only show up on its specific OS. this includes things like GUI, sound-system interfaces, ... generally, it is fairly common practice to wrap a lot of this in OS specific wrapper code, such that the app is mostly dealing with more normalized interfaces internally. for example, low-level memory allocation: #ifdef _WIN32 ptr=VirtualAlloc(...); #endif #ifdef linux ptr=mmap(...); #endif ... but, in general it is far less effort than many people make it out to be, and usually only effects a smaller portion of the total code, provided the developer(s) know what they are doing. personally, I have had relatively few issues with 32 and 64 bit transitions as well. yes, and I have done cross-platform apps with network and sound and GUI...