All of lore.kernel.org
 help / color / mirror / Atom feed
* Why is stdint.h so little used?
@ 2016-11-30 10:12 Bjørn Forsman
  2016-11-30 10:15 ` Bjørn Forsman
  2017-01-24  1:33 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 5+ messages in thread
From: Bjørn Forsman @ 2016-11-30 10:12 UTC (permalink / raw)
  To: The development of GNU GRUB

Hi all,

I see that grub has an stdint.h header in
grub-core/lib/posix_wrap/stdint.h. But hardly any code use it. Why is
that?

When projects have these custom types (e.g. grub_uint32_t) it just
makes porting more difficult IMHO. I'm currently working on a xHCI
driver for GRUB, and I'd like to use stdint.h types (where
appropriate). Any objections?

Best regards,
Bjørn Forsman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is stdint.h so little used?
  2016-11-30 10:12 Why is stdint.h so little used? Bjørn Forsman
@ 2016-11-30 10:15 ` Bjørn Forsman
  2017-01-24  1:33 ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 5+ messages in thread
From: Bjørn Forsman @ 2016-11-30 10:15 UTC (permalink / raw)
  To: The development of GNU GRUB

On 30 November 2016 at 11:12, Bjørn Forsman <bjorn.forsman@gmail.com> wrote:
> Hi all,
>
> I see that grub has an stdint.h header in
> grub-core/lib/posix_wrap/stdint.h. But hardly any code use it. Why is
> that?

The only reason I can think of, in general, is if you want to support
pre-C99 toolchains. But in GRUB's case, the stdint.h header is
provided by the project's source code, so it'll always be available.
Even for pre-C99 toolchains.

Best regards,
Bjørn Forsman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is stdint.h so little used?
  2016-11-30 10:12 Why is stdint.h so little used? Bjørn Forsman
  2016-11-30 10:15 ` Bjørn Forsman
@ 2017-01-24  1:33 ` Vladimir 'phcoder' Serbinenko
  2017-01-24  7:08   ` Bjørn Forsman
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2017-01-24  1:33 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

All files in posix_wrap are only for porting code to GRUB with little
modification. No GRUB-specific code should use it.

On Wed, 30 Nov 2016, 13:17 Bjørn Forsman <bjorn.forsman@gmail.com> wrote:

> Hi all,
>
> I see that grub has an stdint.h header in
> grub-core/lib/posix_wrap/stdint.h. But hardly any code use it. Why is
> that?
>
> When projects have these custom types (e.g. grub_uint32_t) it just
> makes porting more difficult IMHO. I'm currently working on a xHCI
> driver for GRUB, and I'd like to use stdint.h types (where
> appropriate). Any objections?
>
> Best regards,
> Bjørn Forsman
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 1560 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is stdint.h so little used?
  2017-01-24  1:33 ` Vladimir 'phcoder' Serbinenko
@ 2017-01-24  7:08   ` Bjørn Forsman
  2017-01-24  7:35     ` Andrei Borzenkov
  0 siblings, 1 reply; 5+ messages in thread
From: Bjørn Forsman @ 2017-01-24  7:08 UTC (permalink / raw)
  To: The development of GNU GRUB

On 24 January 2017 at 02:33, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.com> wrote:
> All files in posix_wrap are only for porting code to GRUB with little
> modification. No GRUB-specific code should use it.

That only explains half of it :-)

What is better about writing grub_uint32_t instead of uint32_t? (To me
it looks like a pointless indirection.)

Best regards,
Bjørn Forsman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why is stdint.h so little used?
  2017-01-24  7:08   ` Bjørn Forsman
@ 2017-01-24  7:35     ` Andrei Borzenkov
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Borzenkov @ 2017-01-24  7:35 UTC (permalink / raw)
  To: The development of GNU GRUB

On Tue, Jan 24, 2017 at 10:08 AM, Bjørn Forsman <bjorn.forsman@gmail.com> wrote:
> On 24 January 2017 at 02:33, Vladimir 'phcoder' Serbinenko
> <phcoder@gmail.com> wrote:
>> All files in posix_wrap are only for porting code to GRUB with little
>> modification. No GRUB-specific code should use it.
>
> That only explains half of it :-)
>
> What is better about writing grub_uint32_t instead of uint32_t? (To me
> it looks like a pointless indirection.)
>

GRUB boot time code is built without any standard headers at all, so
there is absolutely no difference between defining grub_uint32_t or
uint32_t, in both cases it must be defined in one of grub headers.
There is no indirection at all, because no uint32_t exists. For your
project you can add defines to avoid non-functional changes and then
simply do mass replace ones when porting is complete :)


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-24  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 10:12 Why is stdint.h so little used? Bjørn Forsman
2016-11-30 10:15 ` Bjørn Forsman
2017-01-24  1:33 ` Vladimir 'phcoder' Serbinenko
2017-01-24  7:08   ` Bjørn Forsman
2017-01-24  7:35     ` Andrei Borzenkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.