POV-Ray : Newsgroups : povray.off-topic : C# 4.0 Default parameters : Re: C# 4.0 Default parameters Server Time
9 Oct 2024 18:17:58 EDT (-0400)
  Re: C# 4.0 Default parameters  
From: Warp
Date: 4 Feb 2009 12:57:46
Message: <4989d71a@news.povray.org>
Mike Raiford <"m[raiford]!at"@gmail.com> wrote:
> I remember declaring structs in C being rather weird.

  The problem with C structs is that whenever you want to use them, you
have to say so. In other words, this works in C++, but not in C:

struct Foo { whatever; };

void bar()
{
    Foo foo; // Doesn't work in C
}

  Instead, you have to write:

    struct Foo foo; // Works in both C++ and C

  However, there's a workaround in C (which also works in C++, because of
the backwards compatiblity):

typedef struct { whatever; } Foo;

  Now you can use "Foo" without having to put the "struct" before it every
time.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.