Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Dave Korn" To: Subject: RE: happily messing up with raw devices (aka: lseek problems) Date: Wed, 7 Sep 2005 19:47:28 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <431F321C.108@lapo.it> Message-ID: ----Original Message---- >From: Lapo Luchini >Sent: 07 September 2005 19:32 > Corinna Vinschen wrote: >> Try this: >> #include > > It works. > Silly me, I didn't think about checking headers, as it was good at > compile-time No, it wasn't "good at compile-time". It was bad at compile-time, but you chose to compile without enabling any warnings. dk AT mace /mboa> gcc -Wall short.c -o short short.c:8: warning: return type defaults to `int' short.c: In function `main': short.c:13: warning: implicit declaration of function `lseek' short.c:9: warning: unused variable `sect' short.c:15: warning: control reaches end of non-void function Each of those warnings represents incorrect code on your part. Your coding techniques would have barely scraped by back in 1979. Since 1989, they've just been completely invalid. Stop taking these crude shortcuts - they don't work. Do a bit of cost-benefit analysis: how much time does it save you to not bother writing a #include line? How much time does it cost you to diagnose these very hard-to-spot bugs? It isn't worth it. > (strange thing, tough, read did work, but lseek didn't). That's because all the arguments to read are 32-bits in size, whereas lseek has a variety of differently-sized arguments. Of course, the compiler would have known that if you had given it a prototype for the function. cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/