Op Wed, 27 Feb 2008, schreef Vinzent Hoefler:

You mean like ADA? Indeed, I agree :P

No, I meant languages which are not able to give me bit level control
over a type and have to circumvent this restriction with either
awkward "macro magic" or even can't do nothing at all.

If I mean to set the write buffer water mark of the SDRAM controller
register, I'd rather write:

|SDRAM_Buffer_Control.WB_Watermark := Sixteen;

instead of

|SDRAMBufferControl := (SDRAMBufferControl and not WB_WATERMARK_MASK) or
|                      WB_WATER_MARK_16;

Not even to think of the much more cryptic C version.

Then use bitpacked records:

type  TSDRAM_Buffer_Control=bitpacked record
        {...}
      end;

var SDRAM_Buffer_Control:TSDRAM_Buffer_Control absolute [$xxxxxx];

begin
  {...}
  SDRAM_Buffer_Control.WB_Watermark := Sixteen;
  {...}

Just like Micha I'm not impressed about the Ada code, and it is off-topic, this is and remains a Pascal newsgroup. Comparisons between Pascal and other languages are on-topic, comparisons between C and Ada are off-topic.

Daniël
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to