* Allow C99/C11 in bfd? @ 2020-01-23 10:38 Christian Biesinger via binutils 2020-01-24 11:50 ` Nick Clifton 2020-01-28 1:29 ` Alan Modra 0 siblings, 2 replies; 5+ messages in thread From: Christian Biesinger via binutils @ 2020-01-23 10:38 UTC (permalink / raw) To: binutils; +Cc: gdb Hello! I noticed that bfd is currently using C89. I was wondering if there are any thoughts on allowing C99/C11 in there? It would be nice to be able to declare variables at the time of first use, among other useful features. (I'm not even going to ask about C++, although I think that would be nice) Thanks! Christian ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Allow C99/C11 in bfd? 2020-01-23 10:38 Allow C99/C11 in bfd? Christian Biesinger via binutils @ 2020-01-24 11:50 ` Nick Clifton 2020-01-24 13:20 ` Joel Brobecker 2020-01-28 1:29 ` Alan Modra 1 sibling, 1 reply; 5+ messages in thread From: Nick Clifton @ 2020-01-24 11:50 UTC (permalink / raw) To: Christian Biesinger, binutils; +Cc: gdb Hi Christian, > I noticed that bfd is currently using C89. I was wondering if there > are any thoughts on allowing C99/C11 in there? It would be nice to be > able to declare variables at the time of first use, among other useful > features. I would be willing to consider such a change, provided that there are no strenuous objections... > (I'm not even going to ask about C++, although I think that would be nice) Bah! Real programmers don't use C++! Just joking of course, but I seriously doubt that we will want to change the code base now. Speaking personally I am much more comfortable with C than with C++, but that is probably just me. Cheers Nick ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Allow C99/C11 in bfd? 2020-01-24 11:50 ` Nick Clifton @ 2020-01-24 13:20 ` Joel Brobecker 2020-01-24 16:34 ` Christian Biesinger via binutils 0 siblings, 1 reply; 5+ messages in thread From: Joel Brobecker @ 2020-01-24 13:20 UTC (permalink / raw) To: Nick Clifton; +Cc: Christian Biesinger, binutils, gdb > > (I'm not even going to ask about C++, although I think that would be nice) > > Bah! Real programmers don't use C++! Just joking of course, > but I seriously doubt that we will want to change the code base > now. Speaking personally I am much more comfortable with C > than with C++, but that is probably just me. The way the Pro C++ members of the GDB community approached the suggestion was by building a case of what C++ would bring, concretely, in terms of improvement. They also had a transition plan. As someone who was _not_ in favor of the switch to C++, I had to admit that the C++ proponents had some solid points and that those against did not have a solid counter-argument. It took a while, as a decision of this magnitude always takes, but it helped us keep the discussions focused on factual technical arguments. I thought that worked really way for the GDB group. Assuming the community is not refusing to even hear about the idea, how things happened in GDB could be inspiration for how to at least debate the merits of the change. Note that the idea might be dead right off the bat if being usable from C is an objective of the binutils project. For a relatively low-level library like this one, I wouldn't personally be surprised. -- Joel ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Allow C99/C11 in bfd? 2020-01-24 13:20 ` Joel Brobecker @ 2020-01-24 16:34 ` Christian Biesinger via binutils 0 siblings, 0 replies; 5+ messages in thread From: Christian Biesinger via binutils @ 2020-01-24 16:34 UTC (permalink / raw) To: Joel Brobecker; +Cc: Nick Clifton, binutils, gdb On Fri, Jan 24, 2020 at 2:20 PM Joel Brobecker <brobecker@adacore.com> wrote: > > > > (I'm not even going to ask about C++, although I think that would be nice) > > > > Bah! Real programmers don't use C++! Just joking of course, > > but I seriously doubt that we will want to change the code base > > now. Speaking personally I am much more comfortable with C > > than with C++, but that is probably just me. > > The way the Pro C++ members of the GDB community approached the > suggestion was by building a case of what C++ would bring, > concretely, in terms of improvement. They also had a transition > plan. As someone who was _not_ in favor of the switch to C++, I had > to admit that the C++ proponents had some solid points and that > those against did not have a solid counter-argument. It took > a while, as a decision of this magnitude always takes, but > it helped us keep the discussions focused on factual technical > arguments. I thought that worked really way for the GDB group. > > Assuming the community is not refusing to even hear about the idea, > how things happened in GDB could be inspiration for how to at least > debate the merits of the change. OK. I'm definitely not ready right now to make a full case for switching to C++. Advantages, of course, include easier memory handling with smart pointers and easier string handling with std::string. > Note that the idea might be dead right off the bat if being > usable from C is an objective of the binutils project. For > a relatively low-level library like this one, I wouldn't personally > be surprised. Well, you could still use extern "C" for any entry points and still get a lot of advantages. Anyway, OK, since initial opinions on C99 sound promising I guess I'll send a patch to enable the C99 flag and see if anyone else has opinions. It does not look like autoconf has an easy way to enable C11?! Christian ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Allow C99/C11 in bfd? 2020-01-23 10:38 Allow C99/C11 in bfd? Christian Biesinger via binutils 2020-01-24 11:50 ` Nick Clifton @ 2020-01-28 1:29 ` Alan Modra 1 sibling, 0 replies; 5+ messages in thread From: Alan Modra @ 2020-01-28 1:29 UTC (permalink / raw) To: Christian Biesinger; +Cc: binutils, gdb On Thu, Jan 23, 2020 at 11:37:27AM +0100, Christian Biesinger via binutils wrote: > I noticed that bfd is currently using C89. I was wondering if there > are any thoughts on allowing C99/C11 in there? It would be nice to be > able to declare variables at the time of first use, among other useful > features. It wasn't so long ago that we were using K&R. :-) One of the reasons people used to give for being conservative is that binutils is right at the bottom of the toolchain, and when bootstrapping a new native GNU toolchain target you might not have much in the way of native compiler support. If there isn't an intention of porting gcc for the target (or such support is delayed) then cross-compiling might not be an option. This all presumes a native development system running some sort of OS, but those days are past. With the ubiquity of PCs, nowadays you'll invariably have a cross-toolchain for a new cpu. So there isn't any real reason to stick with c89 IMO. > (I'm not even going to ask about C++, although I think that would be nice) I think any meaningful use of C++ would require a rewrite of BFD. Just satisfying -Wc++-compat is a waste of time and results in a lot of useless casts on bfd_alloc and similar that clutter the source. -- Alan Modra Australia Development Lab, IBM ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-28 1:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-01-23 10:38 Allow C99/C11 in bfd? Christian Biesinger via binutils 2020-01-24 11:50 ` Nick Clifton 2020-01-24 13:20 ` Joel Brobecker 2020-01-24 16:34 ` Christian Biesinger via binutils 2020-01-28 1:29 ` Alan Modra
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).