Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.advocacy > #93529

Re: Reading the Riot Act To ARM's developers

From Phil Carmody <thefatphil_demunged@yahoo.co.uk>
Newsgroups comp.os.linux.advocacy, comp.os.linux.embedded
Subject Re: Reading the Riot Act To ARM's developers
Date 2012-03-03 15:22 +0200
Organization A noiseless patient Spider
Message-ID <87eht9lsyj.fsf@bazspaz.fatphil.org> (permalink)
References (4 earlier) <TIa2r.45441$6J5.28348@newsfe17.ams2> <87zkc4mlho.fsf@bazspaz.fatphil.org> <rKKdna_xZ9tSctbSnZ2dnUVZ8m6dnZ2d@lyse.net> <87aa3ymtwp.fsf@bazspaz.fatphil.org> <ztd4r.173468$M05.23596@newsfe20.ams2>

Cross-posted to 2 groups.

Show all headers | View raw


7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> writes:
> Phil Carmody wrote:
> 
> 
> >> >> Phil Carmody wrote:
> >> >>>> #define INT_XMA (1<<  4)
> >> >>>> #define ENABLE_RS232  SYSCON->INT |= INT_XMA
> >> >>>
> >> >>> Ewwww! Don't do that.
> >> >>>
> >> >>>> The problem I am having is what does that '4' mean. Is it 4 or 14 or
> >> >>>> something else? I need a datasheet. Thats just crap programming.
> >> >>>>
> >> >>>> What I want to be able to do is
> >> >>>>
> >> >>>> #define ENABLED 1
> >> >>>> #define ENABLE_RS232_INTERRUPT  SYSCON.INT.INT_XMA = ENABLED
> >> >>>
> >> >>> Ewww! Don't do that either.
> >> >>>
> >> >>> NACKed.
> >> >>
> >> >> By all means save us the laughs and
> >> >> write one line of code to say what you would do.
> >> >
> >> > Well, even the mindless robotic conversion to
> >> >
> >> > #define ENABLE_RS232_INTERRUPT() do { SYSCON.INT.INT_XMA = ENABLED; }
> >> > #while(0)
> >> >
> >> > would be better than what you had.
> >> >
> >> > Phil
> >> 
> >> I would prefer three lines:
> >> 
> >> static inline void enable_rs232_interrupt(void) {
> >>      SYSCON.INT.INT_XMA = ENABLED;
> >> }
> > 
> > Whilst it is a sensible assumption to presume that SYSCON is visible at
> > the point of definition of the helper, it is by no means guaranteed, as
> > it's not obvious from the above, nor necessary for the macro to work -
> > you have to bear in mind the kind of code we're already dealing with.
> 
> 
> Waaaat?
> 
> 
> Lets say ...

The mere fact that you've felt it necessary to now provide a fuller
example clearly reinforces my point that what you posted earlier 
was capable of being in a context where the change to a function
might not compile. If you can't understand why, then you need to learn 
a bit more about C and its preprocessor. 

Phil
-- 
> I'd argue that there is much evidence for the existence of a God.
Pics or it didn't happen.
-- Tom (/. uid 822)

Back to comp.os.linux.advocacy | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 02:04 +0200
  Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-03 00:20 +0000
    Re: Reading the Riot Act To ARM's developers GreyCloud <cumulus@mist.com> - 2012-03-03 00:06 -0700
    Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 15:22 +0200
      Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 12:28 +0000
        Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-03-04 09:15 -0500
          Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 21:29 +0000

csiph-web