Search Results

Search found 5015 results on 201 pages for 'compiler construction'.

Page 110/201 | < Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >

  • Templated derived class in CRTP (Curiously Recurring Template Pattern)

    - by Butterwaffle
    Hi, I have a use of the CRTP that doesn't compile with g++ 4.2.1, perhaps because the derived class is itself a template? Does anyone know why this doesn't work or, better yet, how to make it work? Sample code and the compiler error are below. Source: foo.C #include <iostream> using namespace std; template<typename X, typename D> struct foo; template<typename X> struct bar : foo<X,bar<X> > { X evaluate() { return static_cast<X>( 5.3 ); } }; template<typename X> struct baz : foo<X,baz<X> > { X evaluate() { return static_cast<X>( "elk" ); } }; template<typename X, typename D> struct foo : D { X operator() () { return static_cast<D*>(this)->evaluate(); } }; template<typename X, typename D> void print_foo( foo<X,D> xyzzx ) { cout << "Foo is " << xyzzx() << "\n"; } int main() { bar<double> br; baz<const char*> bz; print_foo( br ); print_foo( bz ); return 0; } Compiler errors foo.C: In instantiation of ‘foo<double, bar<double> >’: foo.C:8: instantiated from ‘bar<double>’ foo.C:30: instantiated from here foo.C:18: error: invalid use of incomplete type ‘struct bar<double>’ foo.C:8: error: declaration of ‘struct bar<double>’ foo.C: In instantiation of ‘foo<const char*, baz<const char*> >’: foo.C:13: instantiated from ‘baz<const char*>’ foo.C:31: instantiated from here foo.C:18: error: invalid use of incomplete type ‘struct baz<const char*>’ foo.C:13: error: declaration of ‘struct baz<const char*>’

    Read the article

  • Where does code within Script tags go in the resulting AS class?

    - by Hanno Fietz
    I was wondering what happens to the code contained in an <mx:Script> tag. If I define a function tehre, it just becomes a member function of the generated class. But I noticed that it seems OK for the compiler if I just write some (static) method calls there (specifically, I call Font.registerFont()). I feel kind of guilty for doing this, because I have no idea what's really happening and when the code gets executed.

    Read the article

  • mysql for dummies

    - by kalixxx
    I just started using mysql and I just can see myself woking with strings! I mean the compiler cant catch errors like this... and its just a mess! is there a wrapper or some kind of class i can add that does something as simple as making a function that adds a table and asks for args? I'm sure there is a tool like that but i cant find it or know its name. plz help.

    Read the article

  • c++: see compiled object layout

    - by horsthahn
    Hi, is there a way - much like the way i can see the result of preprocessing when using 'gcc -E' - to see what my objects look like once the compiler compiled them into object files? I am not too good in reading assembler, so an advice to get the results as text would be nice .. or at least a little 'howto read the constructor intructions' or 'howto find the constructor' ... I am talking about gcc/g++, but a solution including msvc would be fine. Thanks!

    Read the article

  • Is C really a subset of C++?

    - by Allopen
    What I mean is, can any C code be implemented via C++? Maybe just simply change a compiler? I know C is much more efficient and concise. But despite of these, can C++ used to implement all functions that are implemented by C?

    Read the article

  • readonly property setter

    - by Anonymous Coward
    Hi Everyone After a extensive debugging session I found that the problem was that I called the setter of a readonly property. Is there a trick to provoke a compiler warning when this happens? Because marking the setter private does not work. Cheers, CA

    Read the article

  • 64 bit enum in C++?

    - by Rob
    Is there a way to have a 64 bit enum in C++? Whilst refactoring some code I came across bunch of #defines which would be better as an enum, but being greater than 32 bit causes the compiler to error. For some reason I thought the following might work: enum MY_ENUM : unsigned __int64 { LARGE_VALUE = 0x1000000000000000, };

    Read the article

  • Static member class - declare class private and class member package-private?

    - by Helper Method
    Consider you have the following class public class OuterClass { ... private static class InnerClass { int foo; int bar; } } I think I've read somewhere (but not the official Java Tutorial) that if I would declare the static member classes attributes private, the compiler had to generate some sort of accessor methods so that the outer class can actually access the static member class's (which is effectively a package-private top level class) attributes. Any ideas on that?

    Read the article

  • How to get VS or Xcode warning with something like "x = x++"?

    - by Jim Buck
    In the spirit of undefined behavior associated with sequence points such as “x = ++x” is it really undefined?, how does one get the compiler to complain about such code? Specifically, I am using Visual Studio 2010 and Xcode 4.3.1, the latter for an OSX app, and neither warned me about this. I even cranked up the warnings on VS2010 to "all", and it happily compiled this. (For the record, VS2010's version added 1 to the variable where Xcode's version kept the variable unchanged.)

    Read the article

  • What runs before main()?

    - by MikimotoH
    After testing on msvc8, I found: Parse GetCommandLine() to argc and argv Standard C Library initialization C++ Constructor of global variables These three things are called before entering main(). My questions are: Will this execution order be different when I porting my program to different compiler (gcc or armcc), or different platform? What stuff does Standard C Library initialization do? So far I know setlocale() is a must. Is it safe to call standard C functions inside C++ constructor of global variables?

    Read the article

  • Access element of pointed std::vector

    - by user146780
    I have a function where I provide a pointer to a std::vector. I want to make x = to vector[element] but i'm getting compiler errors. I'm doing: void Function(std::vector<int> *input) { int a; a = *input[0]; } What is the right way to do this? Thanks

    Read the article

  • Downside to including headers in every source file (Objective-C)

    - by Michael Waterfall
    I'm currently including my AppDelegate.h and all of my category headers into every one of my source files using the MyApp_Prefix.pch prefix header, instead of manually #importing them only where they are used. The category methods and lots of compiler #define's in my app delegate are used in lots of places in my code. Is there any down side to this? Is it just that compilation will take longer?

    Read the article

  • Including huge string in our c++ programs ?

    - by Xinus
    I am trying to include huge string in my c++ programs, Its size is 20598617 characters , I am using #define to achieve it. I have a header file which contains this statement #define "<huge string containing 20598617 characterd>" When I try to compile the program I get error as fatal error C1060: compiler is out of heap space I tried following command line options with no success /Zm200 /Zm1000 /Zm2000 How can I make successful compilation of this program? Platform: Windows 7

    Read the article

  • How to add Eclipse Task Tags programmatically (Eclipse Plugin development)?

    - by sebnem
    Hi, I am developing an Eclipse Plugin. I want to add my custom Task Tag programmatically within the plugin. (Lets say DOTHIS) Later, i want to list the lines marked with DOTHIS tag in my custom taskView I know that it is done using the Eclipse UI from Project Properties Java Compiler Task Tags New. and then in the task view by Configure Contents but how can i do these arranegments within the plugin? Thanks in advance.

    Read the article

  • What is the explanation of this java code ?

    - by M.H
    I have the following code : public class Main { public void method(Object o) { System.out.println("Object Version"); } public void method(String s) { System.out.println("String Version"); } public static void main(String args[]) { Main question = new Main(); question.method(null);//1 } } why is the result is "String Version" ? and why there is a compiler error if the first method takes a StringBuffer object ?

    Read the article

  • Weird initialization in C

    - by pacopepe
    Hi there, I have this piece of code and i don't know how it works #include <stdio.h> int main(void) { int numero = ({const int i = 10; i+10;}); printf("%d\n", numero); // Prints 20 return 0; } Why if i delete the second part (i+10;), the compiler gets an error? Why are the brackets necessary? Thank you ^^!

    Read the article

< Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >