Kernel Newbies archive mirror
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com
To: Saad Masood <saadahmed42@gmail.com>
Cc: shiyu chou <shiyu2010310@gmail.com>, kernelnewbies@kernelnewbies.org
Subject: Re: question about boot_params global variables
Date: Sun, 20 Nov 2022 10:46:06 -0700	[thread overview]
Message-ID: <CAJfuBxwz9-49B9GcS5Tug4byfsHddt8jCP2ELuBDtuW04YUabg@mail.gmail.com> (raw)
In-Reply-To: <CAJbqJY6o_9-=6HKm+4jauPqTY4z5Fu5SvCABhPv4SYmXcOtsAQ@mail.gmail.com>

On Mon, Nov 14, 2022 at 11:41 AM Saad Masood <saadahmed42@gmail.com> wrote:
>
> Hi Jim,
>     In C, two global variables with the same name are converted to one global variable (same memory address space).   So, the same variable is referenced with or without the 'extern' keyword.
>
> Thanks,
>
>

thanks Saad,

its nice when a thread reaches a tight conclusion.


>
> Saad
>
> On Mon, Nov 14, 2022 at 11:23 AM <jim.cromie@gmail.com> wrote:
>>
>> On Tue, Aug 16, 2022 at 4:10 AM shiyu chou <shiyu2010310@gmail.com> wrote:
>> >
>> > Hello all:
>> > In arch x86 directory I found two global variables with the same name(master branch):
>> > 1.arch/x86/boot/main.c
>> > near line 18: struct boot_params boot_params __attribute__((aligned(16)));
>> > 2.arch/x86/kernel/setup.c
>> > near line 75: struct boot_params boot_params;
>> > Is that wrong to define two global variables with the same name? And when use extern to reference the variable,which one did it reference?
>> >
>>
>> hi, did you figure out a satisfactory answer ?
>>
>> what happens when you build with W=1 ?
>>
>>
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies@kernelnewbies.org
>> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      reply	other threads:[~2022-11-20 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  9:55 question about boot_params global variables shiyu chou
2022-08-17 10:04 ` Valentin Vidić
2022-11-14 16:22 ` jim.cromie
2022-11-14 18:41   ` Saad Masood
2022-11-20 17:46     ` jim.cromie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJfuBxwz9-49B9GcS5Tug4byfsHddt8jCP2ELuBDtuW04YUabg@mail.gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=saadahmed42@gmail.com \
    --cc=shiyu2010310@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).