Re: [cc65] Common macros for dirent.d_type

From: Groepaz <groepaz1gmx.net>
Date: 2012-06-25 21:40:11
On Monday 25 June 2012, Ullrich von Bassewitz wrote:
> On Mon, Jun 25, 2012 at 06:23:10PM +0200, Oliver Schmidt wrote:
> > >> Maybe I get you wrong but the macros in question are taking the d_type
> > >> field as parameter. So if there's no d_type at all you'd get a
> > >> compiler error.
> > > 
> > > #define _DE_ISREG(t)    0
> > > 
> > > how does that result in a compiler error? code that is written the
> > > "typical" way using these macros might even work correctly without
> > > change =P
> > 
> > A misunderstanding. Now I see your point. I'll add those...
> 
> Sorry, but I don't get it. I'm opposed to using #ifdef as well, but what
> help would it be defining the macros for platforms that don't have d_type?

in almost all cases i have seen these macros used in real code, they occur in 
a form like:

if (_DE_ISREG(foo)) {
	bla
}

this will just work, always. for other occurances you'll get errors - 
coincedently for those who you will have to fix anyway no matter how you do 
it.

> and future platforms. If _DE_ISREG is defined as in Groepaz example, there
> is nothing one can use to detect a platform that doesn't have d_type.

for this sane environments have HAVE_WHATEVER macros. imho.

-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

Being a programmer isn't about social interactions. You want to talk? Talk to 
your fucking coffee. Your keyboard is your instrument, sell your guitar on 
ebay and buy some more ram.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jun 25 21:39:53 2012

This archive was generated by hypermail 2.1.8 : 2012-06-25 21:39:56 CEST