Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Inquiry is fatal to certainty." -- Will Durant


devel / comp.lang.vhdl / How does a HEAD pointer end up pointing to the first node in a linked list?

SubjectAuthor
* How does a HEAD pointer end up pointing to the first node in a linked list?A “Ashvin”
`* How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com
 `* How does a HEAD pointer end up pointing to the first node in aA “Ashvin”
  `* How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com
   `* How does a HEAD pointer end up pointing to the first node in aA “Ashvin”
    +- How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com
    `* How does a HEAD pointer end up pointing to the first node in aKJ
     `* How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com
      `* How does a HEAD pointer end up pointing to the first node in aKJ
       `* How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com
        `* How does a HEAD pointer end up pointing to the first node in aKJ
         `- How does a HEAD pointer end up pointing to the first node in agnuarm.del...@gmail.com

1
How does a HEAD pointer end up pointing to the first node in a linked list?

<0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=170&group=comp.lang.vhdl#170

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:620a:1354:b0:706:7088:1fe9 with SMTP id c20-20020a05620a135400b0070670881fe9mr1790066qkl.11.1674588860473;
Tue, 24 Jan 2023 11:34:20 -0800 (PST)
X-Received: by 2002:a25:3749:0:b0:80b:6fc1:8b32 with SMTP id
e70-20020a253749000000b0080b6fc18b32mr272559yba.126.1674588860212; Tue, 24
Jan 2023 11:34:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Tue, 24 Jan 2023 11:34:19 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2602:306:334c:b080:a4d9:72db:d0f8:ddad;
posting-account=rRWESQoAAABpGoGZN4aaNtcTcmzDYlqZ
NNTP-Posting-Host: 2602:306:334c:b080:a4d9:72db:d0f8:ddad
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
Subject: How does a HEAD pointer end up pointing to the first node in a linked list?
From: ashokmehta72@gmail.com (A “Ashvin”)
Injection-Date: Tue, 24 Jan 2023 19:34:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2674
 by: A “Ashvin” - Tue, 24 Jan 2023 19:34 UTC

The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.

type Item; --Incomplete declaration
type Ptr is access Item;
type Item is record
NextItem : Ptr;
Data : integer;
end record;
variable Head : Ptr;
procedure FIFO_WRITE(Data : in integer) is
variable NewItem : Ptr;
variable Node : Ptr;
begin
NewItem := new Item'(NextItem => Null, Data => Data);
--allocate memory - point to where the Item is stored.
if Head = null then --if the list is empty
Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
else
Node := Head; --start with Root node at the beginning of the list
while Node.NextItem /= null loop --Go through linked list and search for
--last/tail node.
Node := Node.NextItem;
end loop;
Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
end if;
end;

I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.

Thanks.

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=171&group=comp.lang.vhdl#171

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a37:2e43:0:b0:702:1fee:571d with SMTP id u64-20020a372e43000000b007021fee571dmr1173104qkh.253.1674589700118;
Tue, 24 Jan 2023 11:48:20 -0800 (PST)
X-Received: by 2002:a25:7e06:0:b0:7b8:6d00:ef1e with SMTP id
z6-20020a257e06000000b007b86d00ef1emr3733694ybc.342.1674589699748; Tue, 24
Jan 2023 11:48:19 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Tue, 24 Jan 2023 11:48:19 -0800 (PST)
In-Reply-To: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=65.207.89.54; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 65.207.89.54
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Tue, 24 Jan 2023 19:48:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3434
 by: gnuarm.del...@gmail. - Tue, 24 Jan 2023 19:48 UTC

On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
> The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.
>
>
> type Item; --Incomplete declaration
> type Ptr is access Item;
> type Item is record
> NextItem : Ptr;
> Data : integer;
> end record;
> variable Head : Ptr;
> procedure FIFO_WRITE(Data : in integer) is
> variable NewItem : Ptr;
> variable Node : Ptr;
> begin
> NewItem := new Item'(NextItem => Null, Data => Data);
> --allocate memory - point to where the Item is stored.
> if Head = null then --if the list is empty
> Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> else
> Node := Head; --start with Root node at the beginning of the list
> while Node.NextItem /= null loop --Go through linked list and search for
> --last/tail node.
> Node := Node.NextItem;
> end loop;
> Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
> end if;
> end;
>
>
> I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.
>
> Thanks.

It's been a long time since I've used pointers in VHDL. But I believe NULL is used to indicate a pointer has no valid value. I don't think it is pointing anywhere. In your case, it indicates it has not been assigned a value. No?

https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/Null.htm

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=172&group=comp.lang.vhdl#172

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:6214:3483:b0:534:b2a0:5ee1 with SMTP id mr3-20020a056214348300b00534b2a05ee1mr1578802qvb.69.1674668187661;
Wed, 25 Jan 2023 09:36:27 -0800 (PST)
X-Received: by 2002:a0d:cc01:0:b0:506:a79d:e08 with SMTP id
o1-20020a0dcc01000000b00506a79d0e08mr296099ywd.154.1674668187276; Wed, 25 Jan
2023 09:36:27 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Wed, 25 Jan 2023 09:36:26 -0800 (PST)
In-Reply-To: <93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2602:306:334c:b080:a4d9:72db:d0f8:ddad;
posting-account=rRWESQoAAABpGoGZN4aaNtcTcmzDYlqZ
NNTP-Posting-Host: 2602:306:334c:b080:a4d9:72db:d0f8:ddad
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com> <93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: ashokmehta72@gmail.com (A “Ashvin”)
Injection-Date: Wed, 25 Jan 2023 17:36:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4129
 by: A “Ashvin” - Wed, 25 Jan 2023 17:36 UTC

On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
> > The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.
> >
> >
> > type Item; --Incomplete declaration
> > type Ptr is access Item;
> > type Item is record
> > NextItem : Ptr;
> > Data : integer;
> > end record;
> > variable Head : Ptr;
> > procedure FIFO_WRITE(Data : in integer) is
> > variable NewItem : Ptr;
> > variable Node : Ptr;
> > begin
> > NewItem := new Item'(NextItem => Null, Data => Data);
> > --allocate memory - point to where the Item is stored.
> > if Head = null then --if the list is empty
> > Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> > else
> > Node := Head; --start with Root node at the beginning of the list
> > while Node.NextItem /= null loop --Go through linked list and search for
> > --last/tail node.
> > Node := Node.NextItem;
> > end loop;
> > Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
> > end if;
> > end;
> >
> >
> > I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.
> >
> > Thanks.
> It's been a long time since I've used pointers in VHDL. But I believe NULL is used to indicate a pointer has no valid value. I don't think it is pointing anywhere. In your case, it indicates it has not been assigned a value.. No?
>
> https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/Null.htm
>
> --
>
> Rick C.
>
> - Get 1,000 miles of free Supercharging
> - Tesla referral code - https://ts.la/richard11209

Rick, Thanks. I understand what assignment to NULL means. My question is how does HEAD pointer work? All we have done is declare HEAD as a variable. How does it end up pointing to the first node in the list? We haven't allocated any memory to HEAD (i.e. we haven't made the assignment HEAD := new item'(Nextitem => NULL, data=data);). So, how does HEAD know where to point to?

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=173&group=comp.lang.vhdl#173

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:620a:60f6:b0:702:4a94:48e7 with SMTP id dy54-20020a05620a60f600b007024a9448e7mr1382420qkb.578.1674703516808;
Wed, 25 Jan 2023 19:25:16 -0800 (PST)
X-Received: by 2002:a25:7e06:0:b0:7b8:6d00:ef1e with SMTP id
z6-20020a257e06000000b007b86d00ef1emr4389321ybc.342.1674703516562; Wed, 25
Jan 2023 19:25:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Wed, 25 Jan 2023 19:25:16 -0800 (PST)
In-Reply-To: <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=192.254.97.42; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 192.254.97.42
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Thu, 26 Jan 2023 03:25:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4545
 by: gnuarm.del...@gmail. - Thu, 26 Jan 2023 03:25 UTC

On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
> > > The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.
> > >
> > >
> > > type Item; --Incomplete declaration
> > > type Ptr is access Item;
> > > type Item is record
> > > NextItem : Ptr;
> > > Data : integer;
> > > end record;
> > > variable Head : Ptr;
> > > procedure FIFO_WRITE(Data : in integer) is
> > > variable NewItem : Ptr;
> > > variable Node : Ptr;
> > > begin
> > > NewItem := new Item'(NextItem => Null, Data => Data);
> > > --allocate memory - point to where the Item is stored.
> > > if Head = null then --if the list is empty
> > > Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> > > else
> > > Node := Head; --start with Root node at the beginning of the list
> > > while Node.NextItem /= null loop --Go through linked list and search for
> > > --last/tail node.
> > > Node := Node.NextItem;
> > > end loop;
> > > Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
> > > end if;
> > > end;
> > >
> > >
> > > I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.
> > >
> > > Thanks.
> > It's been a long time since I've used pointers in VHDL. But I believe NULL is used to indicate a pointer has no valid value. I don't think it is pointing anywhere. In your case, it indicates it has not been assigned a value. No?
> >
> > https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/Null.htm
> >
> > --
> >
> > Rick C.
> >
> > - Get 1,000 miles of free Supercharging
> > - Tesla referral code - https://ts.la/richard11209
> Rick, Thanks. I understand what assignment to NULL means. My question is how does HEAD pointer work? All we have done is declare HEAD as a variable. How does it end up pointing to the first node in the list? We haven't allocated any memory to HEAD (i.e. we haven't made the assignment HEAD := new item'(Nextitem => NULL, data=data);). So, how does HEAD know where to point to?

Maybe here?

Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.

--

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=174&group=comp.lang.vhdl#174

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:6214:2b86:b0:534:2577:ccda with SMTP id kr6-20020a0562142b8600b005342577ccdamr1820167qvb.32.1674753854644;
Thu, 26 Jan 2023 09:24:14 -0800 (PST)
X-Received: by 2002:a25:9cc5:0:b0:80b:6b1d:5b27 with SMTP id
z5-20020a259cc5000000b0080b6b1d5b27mr1251557ybo.646.1674753854308; Thu, 26
Jan 2023 09:24:14 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Thu, 26 Jan 2023 09:24:14 -0800 (PST)
In-Reply-To: <e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2602:306:334c:b080:e0c7:4136:9f85:fb27;
posting-account=rRWESQoAAABpGoGZN4aaNtcTcmzDYlqZ
NNTP-Posting-Host: 2602:306:334c:b080:e0c7:4136:9f85:fb27
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: ashokmehta72@gmail.com (A “Ashvin”)
Injection-Date: Thu, 26 Jan 2023 17:24:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5193
 by: A “Ashvin” - Thu, 26 Jan 2023 17:24 UTC

On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
> > > > The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.
> > > >
> > > >
> > > > type Item; --Incomplete declaration
> > > > type Ptr is access Item;
> > > > type Item is record
> > > > NextItem : Ptr;
> > > > Data : integer;
> > > > end record;
> > > > variable Head : Ptr;
> > > > procedure FIFO_WRITE(Data : in integer) is
> > > > variable NewItem : Ptr;
> > > > variable Node : Ptr;
> > > > begin
> > > > NewItem := new Item'(NextItem => Null, Data => Data);
> > > > --allocate memory - point to where the Item is stored.
> > > > if Head = null then --if the list is empty
> > > > Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> > > > else
> > > > Node := Head; --start with Root node at the beginning of the list
> > > > while Node.NextItem /= null loop --Go through linked list and search for
> > > > --last/tail node.
> > > > Node := Node.NextItem;
> > > > end loop;
> > > > Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
> > > > end if;
> > > > end;
> > > >
> > > >
> > > > I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.
> > > >
> > > > Thanks.
> > > It's been a long time since I've used pointers in VHDL. But I believe NULL is used to indicate a pointer has no valid value. I don't think it is pointing anywhere. In your case, it indicates it has not been assigned a value. No?
> > >
> > > https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/Null.htm
> > >
> > > --
> > >
> > > Rick C.
> > >
> > > - Get 1,000 miles of free Supercharging
> > > - Tesla referral code - https://ts.la/richard11209
> > Rick, Thanks. I understand what assignment to NULL means. My question is how does HEAD pointer work? All we have done is declare HEAD as a variable. How does it end up pointing to the first node in the list? We haven't allocated any memory to HEAD (i.e. we haven't made the assignment HEAD := new item'(Nextitem => NULL, data=data);). So, how does HEAD know where to point to?
> Maybe here?
> Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> --
>
> Rick C.
>
> + Get 1,000 miles of free Supercharging
> + Tesla referral code - https://ts.la/richard11209

Thanks Rick. But I am doing "if Head = NULL" first and -then- assigning Head := NewItem. So the question is how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory? To simplify the question "where does Head point to when it is first delcared as "variable Head : Ptr".

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<b3086b4b-42a7-420e-ac32-9f0e2110ed1fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=175&group=comp.lang.vhdl#175

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:ac8:1413:0:b0:3a8:16a5:e226 with SMTP id k19-20020ac81413000000b003a816a5e226mr1445150qtj.253.1674778794238;
Thu, 26 Jan 2023 16:19:54 -0800 (PST)
X-Received: by 2002:a81:5553:0:b0:507:e5a9:989d with SMTP id
j80-20020a815553000000b00507e5a9989dmr753931ywb.500.1674778793870; Thu, 26
Jan 2023 16:19:53 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Thu, 26 Jan 2023 16:19:53 -0800 (PST)
In-Reply-To: <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=192.254.97.42; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 192.254.97.42
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b3086b4b-42a7-420e-ac32-9f0e2110ed1fn@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Fri, 27 Jan 2023 00:19:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: gnuarm.del...@gmail. - Fri, 27 Jan 2023 00:19 UTC

On Thursday, January 26, 2023 at 1:24:16 PM UTC-4, ashokm...@gmail.com wrote:
> On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
> > > > > The following code is snippet from a FIFO write/read model. The code works. I am only showing the write procedure. My questions are noted after the code snippet.
> > > > >
> > > > >
> > > > > type Item; --Incomplete declaration
> > > > > type Ptr is access Item;
> > > > > type Item is record
> > > > > NextItem : Ptr;
> > > > > Data : integer;
> > > > > end record;
> > > > > variable Head : Ptr;
> > > > > procedure FIFO_WRITE(Data : in integer) is
> > > > > variable NewItem : Ptr;
> > > > > variable Node : Ptr;
> > > > > begin
> > > > > NewItem := new Item'(NextItem => Null, Data => Data);
> > > > > --allocate memory - point to where the Item is stored.
> > > > > if Head = null then --if the list is empty
> > > > > Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> > > > > else
> > > > > Node := Head; --start with Root node at the beginning of the list
> > > > > while Node.NextItem /= null loop --Go through linked list and search for
> > > > > --last/tail node.
> > > > > Node := Node.NextItem;
> > > > > end loop;
> > > > > Node.NextItem := NewItem; --store NewItem(Item) at the tail end of the list.
> > > > > end if;
> > > > > end;
> > > > >
> > > > >
> > > > > I have a fundamental question. I have declared the variable HEAD to be of type Ptr. Then I check to see if HEAD = NULL. So, all I have done is declare the variable HEAD. How does that end up pointing to the first node in the list? How does the HEAD = NULL work? Is it that when you declare HEAD, that the NextItem of 'record' Item end up pointing to NULL by default? I haven't allocated memory to HEAD. Nothing. Just the declaration causes it to point to the first node in the list? Don't understand that.
> > > > >
> > > > > Thanks.
> > > > It's been a long time since I've used pointers in VHDL. But I believe NULL is used to indicate a pointer has no valid value. I don't think it is pointing anywhere. In your case, it indicates it has not been assigned a value. No?
> > > >
> > > > https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/Null.htm
> > > >
> > > > --
> > > >
> > > > Rick C.
> > > >
> > > > - Get 1,000 miles of free Supercharging
> > > > - Tesla referral code - https://ts.la/richard11209
> > > Rick, Thanks. I understand what assignment to NULL means. My question is how does HEAD pointer work? All we have done is declare HEAD as a variable. How does it end up pointing to the first node in the list? We haven't allocated any memory to HEAD (i.e. we haven't made the assignment HEAD := new item'(Nextitem => NULL, data=data);). So, how does HEAD know where to point to?
> > Maybe here?
> > Head := NewItem; --claim the memory and initialise Root/Head to the claimed memory.
> > --
> >
> > Rick C.
> >
> > + Get 1,000 miles of free Supercharging
> > + Tesla referral code - https://ts.la/richard11209
> Thanks Rick. But I am doing "if Head = NULL" first and -then- assigning Head := NewItem. So the question is how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory? To simplify the question "where does Head point to when it is first delcared as "variable Head : Ptr".

Sorry, there's still a miscommunication somewhere. From the web site I sent you a link for...

"The default value of an access type is null."

https://www.hdlworks.com/hdl_corner/vhdl_ref/VHDLContents/AccessType.htm

I think they are saying it is set to NULL when created. Look at some code and it is clear that is how it works.

This example seems to be for a stack, which is very similar to your FIFO list. The only difference is, that your code would add nodes to one end of the list, and remove them from the other (or copy the data through the list) while the FIFO would add and remove the data from the same end. Oddly enough, this author decided to use the far end of the list as the working end. I have no idea what impact that would have on operation. Are pointers and allocated structures synthesized?

https://vhdlwhiz.com/linked-list/

I don't think I've ever had a need to use pointers other than for strings which were used in simulation to report info to the user or a file. I believe a string is a pointer type, no?

--

Rick C.

-- Get 1,000 miles of free Supercharging
-- Tesla referral code - https://ts.la/richard11209

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=176&group=comp.lang.vhdl#176

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:ad4:5991:0:b0:537:79b9:3ee4 with SMTP id ek17-20020ad45991000000b0053779b93ee4mr464489qvb.55.1674825198056;
Fri, 27 Jan 2023 05:13:18 -0800 (PST)
X-Received: by 2002:a25:c883:0:b0:733:6241:6b0b with SMTP id
y125-20020a25c883000000b0073362416b0bmr3533251ybf.447.1674825197896; Fri, 27
Jan 2023 05:13:17 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 05:13:17 -0800 (PST)
In-Reply-To: <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:d660:9640:65a2:cc86:7e90:d5c6;
posting-account=TJOePQoAAADr-f6dDt_fMmacSJMCG-pd
NNTP-Posting-Host: 2600:1700:d660:9640:65a2:cc86:7e90:d5c6
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: kkjennings@sbcglobal.net (KJ)
Injection-Date: Fri, 27 Jan 2023 13:13:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4007
 by: KJ - Fri, 27 Jan 2023 13:13 UTC

On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail.com wrote:
> On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:

> Thanks Rick. But I am doing "if Head = NULL" first and -then- assigning Head := NewItem. So the question is how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory? To simplify the question "where does Head point to when it is first delcared as "variable Head : Ptr".

The short answer to "where does Head point to when it is first delcared as "variable Head : Ptr" is that it points to nothing at all. For the somewhat longer answer, read on.

When you first declare a variable that is of type access (i.e. your statement "variable Head : Ptr;"), VHDL assigns the variable the 'value' null but it is not pointing to anything at that time. This would be different than in C/C++. For example, in C/C++ you can declare a pointer with "char *MyPtr;". In this situation, MyPtr is not guaranteed to be pointing to anything in particular. It is also not guaranteed to even be NULL. However, VHDL does guarantee that a declared but not explicitly initialized variable (or signal) will always have an initial value. For access type variables, this is defined in section 5.4.1 of the VHDL standard (Access types - General)..

> For each access type, there is a literal null that has a null access value designating no object at all. The null value of an access type is the default initial value of the type

Thus the VHDL standard's answer to your question is, as I stated, "designating no object at all" meaning it doesn't 'point' to anything.

Following that the standard goes into the other values that an access type variable can take on. In the following sentence, an 'allocator' is something that allocates memory, much like 'new' or 'malloc' in C/C++.

> Other values of an access type are obtained by evaluation of a special operation of the type, called an allocator. Each such access value designates an object of the subtype defined by the subtype indication of the access type definition.

Kevin Jennings

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=177&group=comp.lang.vhdl#177

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:622a:183:b0:3b1:c62b:c140 with SMTP id s3-20020a05622a018300b003b1c62bc140mr2015162qtw.313.1674828495017;
Fri, 27 Jan 2023 06:08:15 -0800 (PST)
X-Received: by 2002:a0d:d1c7:0:b0:368:e6b8:77f1 with SMTP id
t190-20020a0dd1c7000000b00368e6b877f1mr3829781ywd.414.1674828494710; Fri, 27
Jan 2023 06:08:14 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 06:08:14 -0800 (PST)
In-Reply-To: <ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=66.50.50.210; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 66.50.50.210
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Fri, 27 Jan 2023 14:08:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4830
 by: gnuarm.del...@gmail. - Fri, 27 Jan 2023 14:08 UTC

On Friday, January 27, 2023 at 9:13:19 AM UTC-4, KJ wrote:
> On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail.com wrote:
> > On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail..com wrote:
> > > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail..com wrote:
>
> > Thanks Rick. But I am doing "if Head = NULL" first and -then- assigning Head := NewItem. So the question is how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory? To simplify the question "where does Head point to when it is first delcared as "variable Head : Ptr".
> The short answer to "where does Head point to when it is first delcared as "variable Head : Ptr" is that it points to nothing at all. For the somewhat longer answer, read on.
>
> When you first declare a variable that is of type access (i.e. your statement "variable Head : Ptr;"), VHDL assigns the variable the 'value' null but it is not pointing to anything at that time. This would be different than in C/C++. For example, in C/C++ you can declare a pointer with "char *MyPtr;". In this situation, MyPtr is not guaranteed to be pointing to anything in particular. It is also not guaranteed to even be NULL. However, VHDL does guarantee that a declared but not explicitly initialized variable (or signal) will always have an initial value. For access type variables, this is defined in section 5.4.1 of the VHDL standard (Access types - General).
>
> > For each access type, there is a literal null that has a null access value designating no object at all. The null value of an access type is the default initial value of the type
>
> Thus the VHDL standard's answer to your question is, as I stated, "designating no object at all" meaning it doesn't 'point' to anything.
>
> Following that the standard goes into the other values that an access type variable can take on. In the following sentence, an 'allocator' is something that allocates memory, much like 'new' or 'malloc' in C/C++.
>
> > Other values of an access type are obtained by evaluation of a special operation of the type, called an allocator. Each such access value designates an object of the subtype defined by the subtype indication of the access type definition.
>
> Kevin Jennings

So is that the same as having the value NULL? Isn't NULL the indication of pointing to nothing?

If it were uninitialized, it could have any value at all. You've not said it is unitialized, and you have not said it contains NULL. "Pointing to nothing" is not clear unless you mean it contains a NULL. You even say "VHDL assigns the variable the 'value' null". So isn't that an adequate explanation rather than the much more wordy statement, "pointing to nothing"? That's the point of "null", it points to nothing.

--

Rick C.

-+ Get 1,000 miles of free Supercharging
-+ Tesla referral code - https://ts.la/richard11209

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=178&group=comp.lang.vhdl#178

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:620a:407:b0:702:4128:2891 with SMTP id 7-20020a05620a040700b0070241282891mr2289829qkp.146.1674832860688;
Fri, 27 Jan 2023 07:21:00 -0800 (PST)
X-Received: by 2002:a25:34cd:0:b0:80b:83b0:c87e with SMTP id
b196-20020a2534cd000000b0080b83b0c87emr1158616yba.360.1674832860541; Fri, 27
Jan 2023 07:21:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 07:21:00 -0800 (PST)
In-Reply-To: <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:d660:9640:65a2:cc86:7e90:d5c6;
posting-account=TJOePQoAAADr-f6dDt_fMmacSJMCG-pd
NNTP-Posting-Host: 2600:1700:d660:9640:65a2:cc86:7e90:d5c6
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com> <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: kkjennings@sbcglobal.net (KJ)
Injection-Date: Fri, 27 Jan 2023 15:21:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4565
 by: KJ - Fri, 27 Jan 2023 15:21 UTC

On Friday, January 27, 2023 at 9:08:16 AM UTC-5, gnuarm.del...@gmail.com wrote:
> On Friday, January 27, 2023 at 9:13:19 AM UTC-4, KJ wrote:
> > On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail.com wrote:
> > > On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail..com wrote:
> > > > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:

> So is that the same as having the value NULL? Isn't NULL the indication of pointing to nothing?
>

For your first question: The VHDL variable is an access type (similar to but not the same as a C/C++ pointer). That variable will have a value which can be the literal null per the standard. If the value of the variable is null, then the standard is saying that you can't access anything with the variable because there is no object to access (per standard "access value designating no object at all."). The ability (or inability) to access something in VHDL is not the same thing as being able to dereference a pointer in software.

For your second question: Yes.

> If it were uninitialized, it could have any value at all.
Not sure what "it" is that you are referring to but a VHDL variable will never have "any value at all". The OP's declaration of variable 'Head', because this is VHDL, means that the compiler will assign the value of null in the OP's code. The same would not be true for a similarly declared pointer in C/C++. In that situation, the C/C++ variable could have 'any value at all' and would be pointing to who knows what.

> You've not said it is unitialized, and you have not said it contains NULL..
The access type variable's value is the literal null (not the literal 0 or anything but 'null').

> "Pointing to nothing" is not clear unless you mean it contains a NULL.

I quoted the standard and then applied the interpretation that I thought would help the OP understand. What I said was
> "designating no object at all" meaning it doesn't 'point' to anything

> You even say "VHDL assigns the variable the 'value' null". So isn't that an adequate explanation rather than the much more wordy statement, "pointing to nothing"? That's the point of "null", it points to nothing.

Well if you didn't like the longer answer, you should have stopped at the short answer that I gave.

You and the OP have been going back and forth for a bit but the OP was still confused about "where does Head point to when it is first declared", so I was just suggesting an alternative explanation and quoting from the standard as the reference. Maybe it helps the OP understand, maybe not.

Kevin Jennings

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<390cb431-76b5-487c-a4d9-01d517d68d90n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=179&group=comp.lang.vhdl#179

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:620a:407:b0:702:4128:2891 with SMTP id 7-20020a05620a040700b0070241282891mr2302634qkp.146.1674836716736;
Fri, 27 Jan 2023 08:25:16 -0800 (PST)
X-Received: by 2002:a25:34cd:0:b0:80b:83b0:c87e with SMTP id
b196-20020a2534cd000000b0080b83b0c87emr1179760yba.360.1674836716469; Fri, 27
Jan 2023 08:25:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 08:25:16 -0800 (PST)
In-Reply-To: <77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=66.50.50.210; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 66.50.50.210
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com> <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
<77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <390cb431-76b5-487c-a4d9-01d517d68d90n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Fri, 27 Jan 2023 16:25:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5364
 by: gnuarm.del...@gmail. - Fri, 27 Jan 2023 16:25 UTC

On Friday, January 27, 2023 at 11:21:02 AM UTC-4, KJ wrote:
> On Friday, January 27, 2023 at 9:08:16 AM UTC-5, gnuarm.del...@gmail.com wrote:
> > On Friday, January 27, 2023 at 9:13:19 AM UTC-4, KJ wrote:
> > > On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail.com wrote:
> > > > On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > > > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del....@gmail.com wrote:
> > > > > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:
>
> > So is that the same as having the value NULL? Isn't NULL the indication of pointing to nothing?
> >
> For your first question: The VHDL variable is an access type (similar to but not the same as a C/C++ pointer). That variable will have a value which can be the literal null per the standard. If the value of the variable is null, then the standard is saying that you can't access anything with the variable because there is no object to access (per standard "access value designating no object at all."). The ability (or inability) to access something in VHDL is not the same thing as being able to dereference a pointer in software.
>
> For your second question: Yes.
> > If it were uninitialized, it could have any value at all.
> Not sure what "it" is that you are referring to but a VHDL variable will never have "any value at all". The OP's declaration of variable 'Head', because this is VHDL, means that the compiler will assign the value of null in the OP's code. The same would not be true for a similarly declared pointer in C/C++. In that situation, the C/C++ variable could have 'any value at all' and would be pointing to who knows what.
> > You've not said it is unitialized, and you have not said it contains NULL.
> The access type variable's value is the literal null (not the literal 0 or anything but 'null').
> > "Pointing to nothing" is not clear unless you mean it contains a NULL.
> I quoted the standard and then applied the interpretation that I thought would help the OP understand. What I said was
> > "designating no object at all" meaning it doesn't 'point' to anything
> > You even say "VHDL assigns the variable the 'value' null". So isn't that an adequate explanation rather than the much more wordy statement, "pointing to nothing"? That's the point of "null", it points to nothing.
> Well if you didn't like the longer answer, you should have stopped at the short answer that I gave.
>
> You and the OP have been going back and forth for a bit but the OP was still confused about "where does Head point to when it is first declared", so I was just suggesting an alternative explanation and quoting from the standard as the reference. Maybe it helps the OP understand, maybe not.
>
> Kevin Jennings

"it points to nothing at all" was your short answer. The rest of that post was the long answer. Neither were great answers. I believe a more useful answer would be that when created, the declaration

variable Head : Ptr;

Gives Head the value NULL.

If you had said this, instead of the less informative answer, "it points to nothing at all", (which may be perfectly accurate, but not so useful) I think that would have been the end of the conversation.

Have I misstated the nature of the ptr declaration?

--

Rick C.

+- Get 1,000 miles of free Supercharging
+- Tesla referral code - https://ts.la/richard11209

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<d8e35ddb-249b-4022-a592-b1fb9da2aae5n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=180&group=comp.lang.vhdl#180

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a37:9a41:0:b0:71a:7038:614b with SMTP id c62-20020a379a41000000b0071a7038614bmr51714qke.579.1674844637165;
Fri, 27 Jan 2023 10:37:17 -0800 (PST)
X-Received: by 2002:a25:97c8:0:b0:7d0:dd57:2834 with SMTP id
j8-20020a2597c8000000b007d0dd572834mr5096362ybo.198.1674844637004; Fri, 27
Jan 2023 10:37:17 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 10:37:16 -0800 (PST)
In-Reply-To: <390cb431-76b5-487c-a4d9-01d517d68d90n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:d660:9640:65a2:cc86:7e90:d5c6;
posting-account=TJOePQoAAADr-f6dDt_fMmacSJMCG-pd
NNTP-Posting-Host: 2600:1700:d660:9640:65a2:cc86:7e90:d5c6
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com> <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
<77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com> <390cb431-76b5-487c-a4d9-01d517d68d90n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d8e35ddb-249b-4022-a592-b1fb9da2aae5n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: kkjennings@sbcglobal.net (KJ)
Injection-Date: Fri, 27 Jan 2023 18:37:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3303
 by: KJ - Fri, 27 Jan 2023 18:37 UTC

On Friday, January 27, 2023 at 11:25:19 AM UTC-5, gnuarm.del...@gmail.com wrote:
> On Friday, January 27, 2023 at 11:21:02 AM UTC-4, KJ wrote:
> > On Friday, January 27, 2023 at 9:08:16 AM UTC-5, gnuarm.del...@gmail.com wrote:
> > > On Friday, January 27, 2023 at 9:13:19 AM UTC-4, KJ wrote:
> > > > On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail..com wrote:
> > > > > On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > > > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > > > > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del....@gmail.com wrote:
> > > > > > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm...@gmail.com wrote:

> "it points to nothing at all" was your short answer. The rest of that post was the long answer. Neither were great answers.
You left out the question that the OP asked which was "how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory" and me saying that it points to nothing at all and that it is set to null seems pretty clear to me.

If you don't think my response is adequate, OK, but I wasn't responding to you, I was responding to the OP. When you had your chance with the OP your responses didn't clarify since he/she had the same question which resulted in the back and forth that the two of you had. Before criticizing my response, perhaps consider your own.

Kevin Jennings

Re: How does a HEAD pointer end up pointing to the first node in a linked list?

<13369da2-2d9d-44d1-84a8-0cf4ee1bec55n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=181&group=comp.lang.vhdl#181

  copy link   Newsgroups: comp.lang.vhdl
X-Received: by 2002:a05:620a:693:b0:706:ad09:af41 with SMTP id f19-20020a05620a069300b00706ad09af41mr1427088qkh.538.1674847217096;
Fri, 27 Jan 2023 11:20:17 -0800 (PST)
X-Received: by 2002:a81:1e8c:0:b0:4b7:dfa2:76f3 with SMTP id
e134-20020a811e8c000000b004b7dfa276f3mr4884118ywe.232.1674847216870; Fri, 27
Jan 2023 11:20:16 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Fri, 27 Jan 2023 11:20:16 -0800 (PST)
In-Reply-To: <d8e35ddb-249b-4022-a592-b1fb9da2aae5n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=66.50.50.210; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 66.50.50.210
References: <0c358282-b93e-4aeb-9987-9421ceaa50d3n@googlegroups.com>
<93ba553c-4fed-468e-b1d4-95bc30e549bfn@googlegroups.com> <6cd48de8-6d5c-4593-9bdb-90422b0712a5n@googlegroups.com>
<e5c6ae1f-4f81-4127-ad78-be8c43c8998cn@googlegroups.com> <85da0872-5fbb-4fd6-bf7b-9c76c55d0576n@googlegroups.com>
<ffbae032-37f5-4d7f-9057-061dad766a1fn@googlegroups.com> <d74b1926-907d-4134-a244-0a621830737fn@googlegroups.com>
<77ec8bfe-8e72-4937-9179-dd78c84463b8n@googlegroups.com> <390cb431-76b5-487c-a4d9-01d517d68d90n@googlegroups.com>
<d8e35ddb-249b-4022-a592-b1fb9da2aae5n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <13369da2-2d9d-44d1-84a8-0cf4ee1bec55n@googlegroups.com>
Subject: Re: How does a HEAD pointer end up pointing to the first node in a
linked list?
From: gnuarm.deletethisbit@gmail.com (gnuarm.del...@gmail.com)
Injection-Date: Fri, 27 Jan 2023 19:20:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3949
 by: gnuarm.del...@gmail. - Fri, 27 Jan 2023 19:20 UTC

On Friday, January 27, 2023 at 2:37:18 PM UTC-4, KJ wrote:
> On Friday, January 27, 2023 at 11:25:19 AM UTC-5, gnuarm.del...@gmail.com wrote:
> > On Friday, January 27, 2023 at 11:21:02 AM UTC-4, KJ wrote:
> > > On Friday, January 27, 2023 at 9:08:16 AM UTC-5, gnuarm.del...@gmail.com wrote:
> > > > On Friday, January 27, 2023 at 9:13:19 AM UTC-4, KJ wrote:
> > > > > On Thursday, January 26, 2023 at 12:24:16 PM UTC-5, ashokm...@gmail.com wrote:
> > > > > > On Wednesday, January 25, 2023 at 7:25:18 PM UTC-8, gnuarm.del....@gmail.com wrote:
> > > > > > > On Wednesday, January 25, 2023 at 1:36:29 PM UTC-4, ashokm...@gmail.com wrote:
> > > > > > > > On Tuesday, January 24, 2023 at 11:48:22 AM UTC-8, gnuarm.del...@gmail.com wrote:
> > > > > > > > > On Tuesday, January 24, 2023 at 2:34:22 PM UTC-5, ashokm....@gmail.com wrote:
>
> > "it points to nothing at all" was your short answer. The rest of that post was the long answer. Neither were great answers.
> You left out the question that the OP asked which was "how do we know that Head is pointing to a node and that the node is null -before- assigning it new memory" and me saying that it points to nothing at all and that it is set to null seems pretty clear to me.
>
> If you don't think my response is adequate, OK, but I wasn't responding to you, I was responding to the OP. When you had your chance with the OP your responses didn't clarify since he/she had the same question which resulted in the back and forth that the two of you had. Before criticizing my response, perhaps consider your own.
>
> Kevin Jennings

Don't be sensitive now. You pointed out that you didn't think I got to the point. I simply explained that you also missed the point in your very short reply, then went way far overboard with the subsequent exquisitely detailed full reply.

Just trying to help by pointing out that too much information is just as bad as too little.

Enjoy your weekend.

--

Rick C.

++ Get 1,000 miles of free Supercharging
++ Tesla referral code - https://ts.la/richard11209

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor