Topic: Init Arrays


Author: "Siper" <nospam@yahoo.com>
Date: Sat, 10 Feb 2001 11:44:47 GMT
Raw View
Hello All!

I was hoping that someone could tell me if:

    bool myNewArray[20][20] = {false};

Is standard C++ or not.

Also, is there a website where I can look these things up?

Thanks,
--

Micah

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Jack Klein <jackklein@spamcop.net>
Date: Mon, 12 Feb 2001 14:44:58 GMT
Raw View
On Sat, 10 Feb 2001 11:44:47 GMT, "Siper" <nospam@yahoo.com> wrote in
comp.std.c++:

> Hello All!
>
> I was hoping that someone could tell me if:
>
>     bool myNewArray[20][20] = {false};
>
> Is standard C++ or not.
>
> Also, is there a website where I can look these things up?
>
> Thanks,

Yes, it is Standard C++.

--
Jack Klein
Home: http://JK-Technology.Com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Mon, 12 Feb 2001 19:06:41 GMT
Raw View
Siper wrote:
>
> Hello All!
>
> I was hoping that someone could tell me if:
>
>     bool myNewArray[20][20] = {false};
>
> Is standard C++ or not.

Yes, bool and false are both standard C++ keywords, and their meanings
are compatible with that declaration.

> Also, is there a website where I can look these things up?

You might try looking at the website whose URL is posted at the bottom
of every message on this newsgroup.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: comeau@panix.com (Greg Comeau)
Date: Mon, 12 Feb 2001 19:06:49 GMT
Raw View
In article <Y1Xg6.74689$R5.3716440@news1.frmt1.sfba.home.com>,
Siper <nospam@yahoo.com> wrote:
>I was hoping that someone could tell me if:
>
>    bool myNewArray[20][20] = {false};
>
>Is standard C++ or not.

It's fine.  But the question is, what do you think it does?
--
Greg Comeau                   Comeau C/C++ 4.2.44 "so close"
ONLINE COMPILER ==>           http://www.comeaucomputing.com/tryitout
4.2.45 during February!       NEW: Try out our C99 mode!
comeau@comeaucomputing.com    http://www.comeaucomputing.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: Martin Sebor <sebor@roguewave.com>
Date: Tue, 13 Feb 2001 15:19:35 GMT
Raw View
Siper wrote:
>
> Hello All!
>
> I was hoping that someone could tell me if:
>
>     bool myNewArray[20][20] = {false};
>
> Is standard C++ or not.

Yes, according to 8.5.1, p11.

>
> Also, is there a website where I can look these things up?

The authoritative document to look it up in is the final C++ Standard. An
electronic copy sells for $18 at http://webstore.ansi.org/AnsiDocStore/.

Regards
Martin

>
> Thanks,
> --
>
> Micah
>
> ---
> [ comp.std.c++ is moderated.  To submit articles, try just posting with ]
> [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
> [              --- Please see the FAQ before posting. ---               ]
> [ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
> [ Note that the FAQ URL has changed!  Please update your bookmarks.     ]

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]





Author: "Ken Hagan" <K.Hagan@thermoteknix.co.uk>
Date: Wed, 14 Feb 2001 16:38:35 GMT
Raw View
Siper wrote:
>
> I was hoping that someone could tell me if:
>
>     bool myNewArray[20][20] = {false};
>
> Is standard C++ or not.

Yes. It initialises the first element to "false" and zeroes
the other 399. In practice, this means that they are false
as well, but if you had written

   bool myNewArray[20][20] = {true};

expecting all 400 to be set "true" you would be disappointed.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]