designated initializers

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hello,

I read that in C99, you can use designated initializers:

--------8<-----------------------------
typedef struct{
    int a,b;
}my_struct;

my_struct My_Struct={.a=10,.b=20};
-------->8-----------------------------

Thus lcc is C99 conform, I get a "compiler trap" trying to use this.

Regards,
Andreas



0
Reply Andi 7/10/2003 5:35:06 AM

See related articles to this posting

"Andi.Martin" <Andi.Martin@freenet.de> wrote in message
news:beitsm$v5v$05$1@news.t-online.com...
> Hello,
>
> I read that in C99, you can use designated initializers:
>
> --------8<-----------------------------
> typedef struct{
>     int a,b;
> }my_struct;
>
> my_struct My_Struct={.a=10,.b=20};
> -------->8-----------------------------
>
> Thus lcc is C99 conform, I get a "compiler trap" trying to use this.

LCC_Win32 is not completely C99 conforming, yet. I'm sure Jacob is working
on C99 conformance though.

John


0
Reply John 7/10/2003 6:04:38 AM
comp.compilers.lcc 1239 articles. 0 followers. Post

1 Replies
201 Views

Similar Articles

[PageSpeed] 1

  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

initialization of signals in design
Hi, I'm currently working on a core to a Microblaze system. It is a bridge between the native OPB bus and a ISA bus interface. Since the ISA bus is working with a clock frequency around 8 MHz I've divided the OPB clock (66 MHz) with 8 to obtain the bus clock signal. It works fine during simulation, but when I try to use the clock signal as a trigger to ChipScope (logic analyser) when everything is synthesized and downloaded to the FPGA, the clock seem to be dead. My guess is that it has to do with the initialization of the different signals and counters utilized by the design. How do I...

A problem with designated initializers
As a const data tables freak, I find it distressing that const int foo[10] = { [5] = 8, [5] = 9, }; compiles by IAR (EWARM 4.40a) without any warnings. (Nor does PC-Lint 8.00u see anything wrong.) The actual content at an index happens to be the last initializer for it. Is this indeed legal? If so, what's the rationale behind it? Thanks, - Ark Ark wrote: > As a const data tables freak, I find it distressing that > const int foo[10] = { > [5] = 8, > [5] = 9, > }; > compiles by IAR (EWARM 4.40a) without any warnings. (Nor does PC-Lint > 8.00u see anything w...

Initialization of designated subaggregates
Given struct foo { int z; }; struct bar { struct foo a; }; it is clear that struct foo a = 2; is not permitted - we do not implicitly enter struct foo to initialize z. However, what is the status of the following? struct bar t = { .a = 2 }; Is this invalid, or does it implicitly enter struct foo and initialize z, in the same way that struct bar t = { 2 }; does? Neil wrote: > Given > > struct foo { int z; }; > struct bar { struct foo a; }; > > it is clear that > > struct foo a = 2; > > is not permitted - we do not implic...

C99 designated initializers in C++
What is the status of C99 "designated initializers" in C++ ? {Not supported by the Standard Language. -mod/fwg} ___________________________________________________ Check-out GO.com GO get your free GO E-Mail account with expanded storage of 6 MB! http://mail.go.com [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] Retlak Yezdegird <retlak@go.com> wrote in message news:<4085383.1096038235727.JavaMail.retlak@gomailjtp03>... > What is the status of C99 "designat...

Initialize variant control in design mode
How do I initialize a variant control in design mode. I need to do this to test the VI without actually connecting to the system. This VI stores readings (floats, dates, ints, strings, etc) into the database. You can't enter stuff directly into the control, so you have to use an indirect method. One way is to have an indicator already populated with the data, change it to a control, right-click on the control and select Data Operations -&gt; Make Current Value Default. How do I populate the indicator with data? Use the To Variant function (in the Cluster &amp; Variant palette) ...

Designated struct initializers with Visual C++
I'm used to initializing struct fields by name using the designator syntax that is a part of ISO C99. For example: struct foo { int x; int y; int z; }; struct foo a = { .x = 1, .z = 3 }; This works perfectly under all the versions of gcc that I use. Unfortunately, I've recently had to port some of my code to compile with Microsoft Visual C++ under Windows. The code above gives a syntax error, and I can't find anything in the Microsoft documentation about any struct initializers other than the very basic: struct foo a...

Initialization using the Singleton design pattern
Hi, I have a singleton class, as in one that does "include Singleton". I want to run a few methods when the instance is created. Usually one would do that in initialize(), but obviously I can't do that here. This is what I've thought of but it raises an error which says "super: no superclass method `instance'" class SingletonClass < ParentClass include Singleton def self.instance super # initialization code here end end What am I doing wrong? Cheers -- Jonathan Leighton http://turnipspatch.com/ | http://jonathanleighton.com/ | http://di...

C99 designated initializers in C++0x
Hello group, What is the status of C99 designated initializers in C++0x? I looked in N2800 but couldn't find anything related to it, and I also searched comp.std.c++ and comp.lang.c++.moderated but couldn't find anything more recent than 2004. I'm asking this because it is a very useful feature, even in C++, especially because of C-compatible APIs that take structs. For example, I see a lot of the following pattern: struct timeval timeout; timeout.tv_sec = 2; timeout.tv_usec = 500000L; // followed by select(..., &timeout) It would be ...

Re-initializing the FDAtool (digital filter design)
Hello, I'm using the F.D.A. Block in Simulink with different Magnitude vectors. (Matlab 7) The problem is that to design a new filter with the given vector c', each time I have to open the block, click on the 'Mag. vector' entry field, press <Enter> (without even changing the name of the variable - c'>, then click 'Design Filter'. I would be very grateful if someone sent me the code enabling to do it from the Matlab prompt (property and value based -probably) or told me how to write it... Thanks for any help! Cheers, Helwald U┼╝ytkownik helwald nap...

Design question: class methods verses initialize
I have a design question for a beginner: what is better for my case? I want to access functionality from a library I created. I've tried class methods like this: class Calc def Calc.velocity_head(v) v**2/(2.0*G) end def Calc.pressure_head(p) h = p / Gamma end def etc... end This is nice because now I can create many "velocity_head" objects or "pressure_head" objects as needed by doing vh1 = Calc.velocity_head(4.5) for example. But what if I have a bunch of methods in a class that all require the same exact arguments? My first thought was using initi...

design question: per method static initializer code
I have methods in which I need to perform once-only initialization. This is similar to static initializer blocks in Java, but not exact since initializer blocks are on per-class basis. I have in mind static initializer on per-method basis. struct Foo { void Bar() { <static initializer code> // this should be executed only once <other code> } }; The way I am doing it is: struct Foo { void Bar() { struct StaticBarInitialzer // internal helper class to do the needful { <static initializer code> ...

Design question: best way for initializing many small objects
Hi! I've lots of objects (call them X509Certificate) that all have in common that they are using an object (call it X509_STORE*) which is initialized early at program startup. What's the best strategy for making X509_STORE visible to the X509Certificates ("best" is certainly very subjective. Nevetheless, I am trying to get a feeling for this class of problems, so every opinion is welcome :-) a) Equipping each and every object with a X509_STORE* member and initialize them accordingly? -> certainly brainless alternative with regards to resource waste. Also, X509_STORE* m...

C vs. C++: non-trivial designated initializers not supported
Hello group, I know this might be an implementation detail - however I do not understand why the languages C++ and C are different in the following example - I'm quite stunned and am looking for an explanation. Writing some code and porting from C to C++ I encountered the error "sorry, unimplemented: non-trivial designated initializers not supported" from g++ 4.3.4. I boiled it down to a minimal example which compiles fine under C, but emits that error message when compiled under C++: typedef void (*FunctionType)(void); typedef struct PODObject { void *PointerVal...

how can i design a robust contoller, that performs well when plant has initial conditions?
My controller performs well when the initial conditions are zero, but when i change initial conditions, the controller doesn't track the setpoint. how can i solve this? thank you ...

UK-LON Ora DBA/Design for Startup Product
Could you architect the next salesforce.com? UK, London applicants only. No relocation, sorry. No agencies. Start-up environment - no pension, no benefits, low initial pay (we don't mean low day rates - we mean low monthly rates - think 'money to live on'), no training. You're probably going to do this because you have been successful, have some financial cushion, and are interested in high risk/reward. Intense working environment. Risk. 1 month probation. Still interested ? WANTED - master craftsman Oracle DBA/Designer with Java/Linux to develop commercial ...

Data Environment Designer
Hello -- There are too many columns in the table to fit on a form when dragging the DED's table's Command node onto the form. I need to add to the form some of those columns which did not come onto the form in that initial dragging. After dragging one of the required fields "ColumnName" from the DED view (becomes txtColumnName on the form) onto the form, the app shows an error: "method or data member not found" caused by the line frm_MyForm.txtColumnName.BackColor = vbRed Is it not possible to drag again, as I need to do? Are there propert...

[rfc-dist] RFC 6357 on Design Considerations for Session Initiation Protocol (SIP) Overload Control
A new Request for Comments is now available in online RFC libraries. RFC 6357 Title: Design Considerations for Session Initiation Protocol (SIP) Overload Control Author: V. Hilt, E. Noel, C. Shen, A. Abdelal Status: Informational Stream: IETF Date: August 2011 Mailbox: volker.hilt@alcatel-lucent.com, eric.noel@att.com, charles@cs.columbia.edu, aabdelal@sonusnet.com Pages: ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes. ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes.for more information www.acedezines.com On 3/11/2011 3:26 AM, a SPAMMER wrote: > SPAM services, SPAM Conversion Services, Offshore SPAMMING > SPAM design& SPAM Expert WE ARE SPAMMERS provides best SPAM for your > SPAM design, SPAM optimization, SPAM design services, > SPAM design, SPAM intro animatio...

Web design services | website designing | hire a website designer | creative web design
joomla cms templates, brochure design, flash intro animation, website designing, , ecommerce web design, affordable web design, content management system, website design, hire a website designer, flash web page design, web design agency, professional web design company, flash website design, web design company, website maintenance, top web design companies, creative web design, content development, Logo Designing ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes. for more details http://www.acedezines.com ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes. ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes. ...

Web design services | website designing | hire a website designer | creative web design
web design services, XHTML Conversion Services, Offshore outsourcing web design & SEO Expert Acedezines provides best services for your website design, search engine optimization, web design services, brochure design, flash intro animation, website designing, wordpress themes. ...