473,803 Members | 3,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

double pointers

Do all double pointers have same size on a particular implementation.

eg char **c_ptr;
int **i_ptr;

Is the size of c_ptr and i_ptr always same (on same implementation)
or it may be different ?

Nov 14 '05
11 2203
CBFalconer wrote:
Robert Gamble wrote:
CBFalconer wrote:
Ravi Uday wrote:
S.Tobias wrote:

... snip ...

> Apart of that, pointers to structs, unions and un/qualified
> compatible types have to have the same representation (and
> size) within their respective group.

couldnt get that. Do you mean sizeof (struct *a) == sizeof
(union *b) etc !

Yes. This is needed so self-referencing structures can be created,
as in:

struct blah {
struct blah *next;
whatever info;
}

because the need for struct blah * size arises before struct blah
has been defined.


I not making the connection here. Why does this require that
sizeof(struct *a) == sizeof(union *b) and from where in the Standard
to you conclude that this statement is guaranteed to be true?


Because, to saw off enough space to hold a struct blah, you have to
know how much room a struct blah * takes (with the above
definition). Thus the size and alignment of a struct blah * cannot
depend on the size of a struct blah.


What does this have to do with unions though?

Robert Gamble

Nov 14 '05 #11
CBFalconer <cb********@yah oo.com> writes:
Robert Gamble wrote:

[...]
I not making the connection here. Why does this require that
sizeof(struct *a) == sizeof(union *b) and from where in the Standard
to you conclude that this statement is guaranteed to be true?


Because, to saw off enough space to hold a struct blah, you have to
know how much room a struct blah * takes (with the above
definition). Thus the size and alignment of a struct blah * cannot
depend on the size of a struct blah.


That implies that all struct pointers have to be the same size, and
that all union pointers have to be the same size. It doesn't imply
that struct pointers have to be the same size as union pointers
(though I'd bet they are on everything other than the DS9K).

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2790
by: Venkat | last post by:
Hi All, I need to copy strings from a single dimensional array to a double dimensional array. Here is my program. #include <stdio.h> #include <stdlib.h>
7
1714
by: ffld | last post by:
Greetings all i am having a horrible time trying to pass a 2 dimensional array of doubles to a function... basically a watered down version of my code looks like: void t1(double a); int main() { double d; d = 2.3;
12
9895
by: Sydex | last post by:
When I compile code I get error C2664: 'Integration::qgaus' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(double)' in this part : double Integration::quad2d(double (*func)(double,double)) { nfunc = func ; return qgaus(f1,x1,x2);//error there
4
3607
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; };   struct pcb *pcb_pointer;
3
1478
by: Peteroid | last post by:
I'm using VS C++.NET 2005 Express in /clr. How do I create, and then use, a '^' pointer to a 'double'? That is, assuming its possible, please fill in the question marks below (there are two of them): double x = double(7) ; double y ; double^ x_ptr = ?x ; y = ?x_ptr ; // y = double(7)
2
1544
by: Paminu | last post by:
I am implementing a double-linkedlist in C. I have defined some pointers that points to different locations in my list. Before using the list I will initialize these pointers and when I call insert/delete etc they will be changed. Instead of giving each funtion these pointers as argumentens I was wondering if it was possible to place them i a .h file and initialize them there. When a function changes the pointers they will be updated in...
42
5350
by: xdevel | last post by:
Hi, if I have: int a=100, b = 200, c = 300; int *a = {&a, &b, &c}; than say that: int **b is equal to int *a is correct????
2
2181
by: anon.asdf | last post by:
Hi! Q. 1) How does one write: sizeof(array of 5 "pointers to double") ??? I know that sizeof(pointer to an array of 5 doubles) can be written as: sizeof(double (*));
4
7579
by: Sagaert Johan | last post by:
Hi I am struggling with pinvoke I have dll a function that is declared as : sf_command (IntPtr sndfile,int command, IntPtr data, int datasize); i need to pass a pointer to a double in the data parameter, i now did : IntPtr mem = Marshal.AllocHGlobal(sizeof(double));
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.