error: braces around scalar initializer

Discussion to talk about software related topics only.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: error: braces around scalar initializer

Post by seulater »

OHhhh.. This namespace gets around another problem that i had.

Thanks guys very much for all your help. I will go with the namespace concept.

Edit: Scratch that, though i love the idea of using the namespace. The problem i found out about it is that since i have 24 font files, when i implement this namespace it includes all of them even though i am not using any of it. when i use the static idea, it does not. with the static, it only pulls the fonts that i am using in the project into the compile. This is nice. Though is there a way to have the best of both worlds ?

I changed it to this:

Code: Select all

const struct Font12F
{
	XySize sizeInfo;
	BYTE fontdata[24];
}

Font12F [95] =
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: error: braces around scalar initializer

Post by tod »

I saw one of the deleted entries in email and I would like to correct my mistake even though the reference to it is gone. I said you could do this
using namespace Font12;
//.. use things from font 12
using namespace Font16
//..use things from font 16.

This brings both namespaces into the global context at the same time. With a lot of namespaces that is fine. However, in this case I was suggesting the use of namespaces to allow a single naming approach for all the fonts (probably not a great idea in the first place - but hey it's Sunday). So now the items named the same will collide with each other. The approach where you fully specify each instance would still work
Font12::style...
Font16::style...

but it's still a better idea to name each Font struct and each style name differently. It's still a good idea to use namespaces, although now you could use a single namespace for all the fonts.
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: error: braces around scalar initializer

Post by seulater »

I wanted to use your idea. Having a single name for all the fonts, but i could not get it to compile. It would say that "style" was to vague.
Post Reply