Feature Requests item #1961855, was opened at 2008-05-11 14:12
Message generated for change (Comment added) made by maurogiachero
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=350599&aid=1961855&group_id=599
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Andreas Czechanowski (acz)
Assigned to: Nobody/Anonymous (nobody)
Summary: pic16: use for binary constants (0b00110101)
Initial Comment:
For porting of source written for the Microchip MCC18, the possibility of writing binary constants starting with 0b... (equivalent to 0x... for hex) is appreciated.
Although this does not confirm to C-standards, it might be useful for other architectures as well.
Regards, Andreas.
----------------------------------------------------------------------
Comment By: Mauro Giachero (maurogiachero)
Date: 2008-07-30 19:03
Message:
Logged In: YES
user_id=2160854
Originator: NO
I didn't know about GCC either, so I can't really use that as an
"excuse"...
Mauro
----------------------------------------------------------------------
Comment By: Mauro Giachero (maurogiachero)
Date: 2008-07-30 18:56
Message:
Logged In: YES
user_id=2160854
Originator: NO
No offense at all, really! I certainly don't think that a couple of bug
fixes give me the right of deciding whether a feature must be accepted or
not.
About the other compilers having this feature, I used in the past Hi-Tech
PICC and MELabs Pic Basic Pro in PIC14 projects, and both have binary
constants. I used that feature a lot on initialization, when different bits
of a single byte can have completely different meanings.
Having this feature enabled only under --std-sdccXX can be a good idea. I
can certainly look at it, but I'd like to see some consensus about the
decision of applying it once done (so little time, so many things to do!).
Mauro
----------------------------------------------------------------------
Comment By: Frieder Ferlemann (frief)
Date: 2008-07-30 18:47
Message:
Logged In: YES
user_id=589052
Originator: NO
Hi,
I was not aware that GCC also supports this binary notation.
>From http://gcc.gnu.org/gcc-4.3/changes.html :
"Integer constants written in binary are now supported as a GCC
extension.
They consist of a prefix 0b or 0B, followed by a sequence of 0 and 1
digits."
So I retract my objection - thanks and apologies to Mauro!
Greetings,
Frieder
----------------------------------------------------------------------
Comment By: Borut Raem (borutr)
Date: 2008-07-30 18:16
Message:
Logged In: YES
user_id=568035
Originator: NO
I agree that it could be enabled only under --std-sdccXX, but on my
opinion it just introduces the confusion.
I just expressed my personal opinion. If somebody thinks that the feature
is indispensable, feel free to apply the patch, probably with the
modification that the feature is active only under --std-sdccXX.
Mauro, I hope I didn't offend you. Thank you for your great patches!
Borut
----------------------------------------------------------------------
Comment By: Maarten Brock (maartenbrock)
Date: 2008-07-30 12:11
Message:
Logged In: YES
user_id=888171
Originator: NO
First let me say that I would not have any problem with this feature
implemented in SDCC. I don't believe it results in "vendor lock in" because
it's entirely up to the user to use it or not. You can always use strict
ANSI/ISO C without penalty. But I would only want it enabled under
--std-sdccXX. OTOH I have no problem with rejecting the feature and keeping
it out of SDCC either.
I did some some searching about your claim that all other compilers for
microcontrollers support this feature. I could find only GCC. The others
(IAR, Keil, ARM) do not support this. I agree that it should have been in
the spec but that is outside of my control.
Maarten
----------------------------------------------------------------------
Comment By: Mauro Giachero (maurogiachero)
Date: 2008-07-30 10:02
Message:
Logged In: YES
user_id=2160854
Originator: NO
I'm fine with the reject decision, as the patch is available anyway for
those who really want that feature. And I didn't know about the macro,
sorry.
I feel nevertheless that the "lock-in" argument is weak: all compilers
targeting microcontrollers I know about (not many, all commercial) have
this feature, and while I'm certainly biased about this I always felt that
it not being ANSI C is somewhat a lack of the specification.
Anyway as I said I'm fine with the reject. And thank you for
writing/maintaining/... sdcc!
With best regards
Mauro
----------------------------------------------------------------------
Comment By: Borut Raem (borutr)
Date: 2008-07-29 22:36
Message:
Logged In: YES
user_id=568035
Originator: NO
I agree with Frieder: this is not an ANSI C standard feature and sdcc
tends to be ANSI C compliant. And there is an excellent macro provided by
Bernhard, which fills the gap.
Borut
----------------------------------------------------------------------
Comment By: Frieder Ferlemann (frief)
Date: 2008-07-29 21:27
Message:
Logged In: YES
user_id=589052
Originator: NO
Hi,
sorry to say: I don't like this idea:
It can be seen as a kind of "vendor lock in"
(providing features that an ANSI-C compiler does not have)
And (slightly inflamatory) if you like the idea you might
have been exposed to this kind of "vendor lock in" :^)
There has been related discussion about this (at least) here
(sorry, both the search function on Sourceforge and its web interface
to list/forums seem disfunctional at the moment, so it seems I cannot
provide direct links)
2007-02-17 [Sdcc-user] binary representation of integer?
2007-06-18 [Sdcc-user] How to express binary number in SDCC?
2007-05-29 [sdcc - Open Discussion] binary constant
and preprocessor workarounds have been (at least) proposed here:
http://sourceforge.net/tracker/index.php?func=detail&aid=882215&group_id=599&atid=350599http://sourceforge.net/forum/message.php?msg_id=4334535
Please do not apply.
----------------------------------------------------------------------
Comment By: Mauro Giachero (maurogiachero)
Date: 2008-07-29 00:30
Message:
Logged In: YES
user_id=2160854
Originator: NO
Addressed by patch 2030780 at
http://sourceforge.net/tracker/index.php?func=detail&aid=2030780&group_id=599&atid=300599
Mauro Giachero
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=350599&aid=1961855&group_id=599

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details