473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why this declaration is legal

Hi All,

I saw a code:

vertexBuffer = new VertexBuffer(
typeof(CustomVertex.TransformedColored), 3, dev, 0,
CustomVertex.TransformedColored.Format, Pool.Default);

but why not:

VertexBuffer vertexBuffer = new VertexBuffer(
typeof(CustomVertex.TransformedColored), 3, dev, 0,
CustomVertex.TransformedColored.Format, Pool.Default);

Best regards,
Boki.

Reply

May 11 '06 #1
3 1921
Boki,

They should both be legal. What is the compiler error that you are
getting with the second declaration?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Boki" <bo******@ms21.hinet.net> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Hi All,

I saw a code:

vertexBuffer = new VertexBuffer(
typeof(CustomVertex.TransformedColored), 3, dev, 0,
CustomVertex.TransformedColored.Format, Pool.Default);

but why not:

VertexBuffer vertexBuffer = new VertexBuffer(
typeof(CustomVertex.TransformedColored), 3, dev, 0,
CustomVertex.TransformedColored.Format, Pool.Default);

Best regards,
Boki.

Reply

May 11 '06 #2
"Boki" <bo******@ms21.hinet.net> a ecrit dans le message de news:
11*********************@i40g2000cwc.googlegroups.c om...

| I saw a code:
|
| vertexBuffer = new VertexBuffer(
| typeof(CustomVertex.TransformedColored), 3, dev, 0,
| CustomVertex.TransformedColored.Format, Pool.Default);
|
| but why not:
|
| VertexBuffer vertexBuffer = new VertexBuffer(
| typeof(CustomVertex.TransformedColored), 3, dev, 0,
| CustomVertex.TransformedColored.Format, Pool.Default);

Why not indeed ? Both are legal, the first one assumes that there is already
either a field or a local variable of type VertexBuffer called vertexBuffer.
The second line declares the variable and initialises it at the same time.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
May 11 '06 #3

Joanna Carter [TeamB] 寫道:
"Boki" <bo******@ms21.hinet.net> a ecrit dans le message de news:
11*********************@i40g2000cwc.googlegroups.c om...

| I saw a code:
|
| vertexBuffer = new VertexBuffer(
| typeof(CustomVertex.TransformedColored), 3, dev, 0,
| CustomVertex.TransformedColored.Format, Pool.Default);
|
| but why not:
|
| VertexBuffer vertexBuffer = new VertexBuffer(
| typeof(CustomVertex.TransformedColored), 3, dev, 0,
| CustomVertex.TransformedColored.Format, Pool.Default);

Why not indeed ? Both are legal, the first one assumes that there is already
either a field or a local variable of type VertexBuffer called vertexBuffer.
The second line declares the variable and initialises it at the same time.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


Hi All,
Sorry, I miss there is a public variable:

/////////////////////////////////////////////////////////////
public class Vertices : Form
{
// Our global variables for this project
Device device = null; // Our rendering device
VertexBuffer vertexBuffer = null;

Best regards,
F.Y.

May 12 '06 #4

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

Similar topics

3
by: b83503104 | last post by:
Hi, I wonder if this is a legal array declaration? const int size = 5; double array; Or should I use "new"? Thanks.
16
by: herbertF | last post by:
Hi guys, In a program (not my own) I encountered the declaration of a constant pointer to an array consisting of two other const pointers to arrays. Not quite sure why they do it so complicated,...
11
by: Martin Eisenberg | last post by:
Hi Antoine, just redirecting you... Antoine Trux wrote: > Hi, > > Is the following code legal: > > ------> code starts here <------ > #include <stddef.h>
21
by: Kannan | last post by:
Its been a while I have done pure C programming (I was coding in C++). Is the following function valid according to standard C? int main(int argc, char *argv) { int x; x = 9; printf("Value...
8
by: Pedro Pinto | last post by:
When compiling my program i got this error: Error: 'for' loop initial declaration used outside c99 mode What is it and how can i solve it? Thanks in advance! Regards
3
by: arnuld | last post by:
1) int i = 3; 2.) int* pi; 3.) int* pi2 = &i 4.) char* pc; 5.) char c; 6) char c2 = 'a' 7.) char* pc2 = &c2 8.) char* ps = "Stroustroup"; 9.) extern double d;
8
by: Mohammad Omer Nasir | last post by:
Hi, i made a structure in header file "commonstructs.h" is: typedef struct A { int i; A( ) {
13
by: Carramba | last post by:
Hi! I have written some peace of code, but I wonder if it's legal for ansi-c I have no problem to compiling it, but since I'm inexperience and the output is not correct I have doubts. Thank you...
14
by: subramanian100in | last post by:
Consider the following program: #include <iostream> using namespace std; int main() { int i;
4
by: subramanian100in | last post by:
Consider the following: Class Test { public: Test(Test_int arg) : val(arg) { } typedef int Test_int; private:
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.