Re: pointer-to-pointer (invalid lvalue in unary `&)

From: Chris Fogelklou (chris.fogelklou_at_comhem.se)
Date: 04/04/04


Date: Sun, 04 Apr 2004 17:04:08 GMT


> That doesn't seem very fruitful advice. He'd be better off trying to
> understand the type system than trying to learn how to circumvent it.
>
Yep.

>>changing your debugging process from finding a syntax
> > error to figuring out why your computer is crashing :)
>
> Finding the syntax error is much easier

Hence the smiley and the statement that he would have to figure out why the
computer is crashing (sarcasm... oops... my bad :)

> > pointer = (struct example_struct **pointer)&ex_ptr;
>
> That cast is badly-formed, and requires a diagnostic.

Hmm... It compiles on my system... but from the other posts/responses I've
been participating in, I think my system might be broken. Could you please
elaborate?

typedef struct ui_tag {
  uint16 i;
  uint16 j;
  uint16 k;
  uint16 l;
} ui_t, *pui_t;

void main(void)
{
  struct ui_tag * ptr_ui;
  struct ui_tag ** pptr_ui;
  struct ui_tag ui = {0,0,0,0};

  ptr_ui = &ui;
  pptr_ui = (struct ui_tag **)&ptr_ui;
  while(1);

}



Relevant Pages

  • Re: pointer-to-pointer (invalid lvalue in unary `&)
    ... >> understand the type system than trying to learn how to circumvent it. ... > typedef struct ui_tag { ... > uint16 i; ... well-formed cast, but is not. ...
    (comp.lang.c)
  • Get the bit field or bit size from pdb file
    ... typedef unsigned short int UINT16; ... } FLAGS; ... When getting information from the pdb file using DIA's ...
    (microsoft.public.vc.debugger)
  • Re: What is UShort? (and how can I not use it?)
    ... so now SQL Server wil match Visual Studio, ... I don't see any direct relation between SQL Server's type system and VB's type system. ... 'UShort' is simply an alias for the BCL's 'UInt16' type, which already existed in .NET 1.0. ... Nevertheless it was possible to use the type as 'UInt16' with some limitations in VB.NET 2002/2003. ...
    (microsoft.public.dotnet.languages.vb)