Find the errors from following C function :
char* f(int i) {
int i;
char buffer[20];
switch ( i ) {
1: strcpy( buffer, "string1");
2: strcpy( buffer, "string2");
3: strcpy( buffer, "string3");
default:
strcpy(buffer, "defaultstring");
}
return buffer;
}
this is c funtion not C++, I think it has to do with type conversion
my compiler give warning that declaration of int i shadows a parameter.
AFAIK, we can have two static variables with the same name in different functions? How are these managed by the compiler and symbol table? How are their identities managed seperately?
I'm having trouble with the following collections initalization:
private Dictionary<string, string> mydictionary = new Dictionary<string, string>()
{
{"key", "value"}
, {"key2", "value2"}
, {"key3", "value3"}
};
I keep getting various compiler errors about the syntax. From what I have googled this should be perfectly valid C# 3.0 code.
The first error that pops up is:
Error 102 ; expecte
What am I doing wrong?
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
in vb code-i used namespace and a class.
I know that the C++ standard says that return 0 is inserted at the end of main() if no return statement is given; however, I often see recently-written, standard-conforming C++ code that explicitly returns 0 at the end of main(). For what reasons would somebody want to explicitly return 0 if it's automatically done by the compiler?
In Python there is a recursion depth. Seems it is because Python is an interpreter, not a compiler. Does C++ have the same concept? Or it only connected with RAM limit?
Hey,
I'm trying to use the Libxl library in my eclipse c/c++ project. Right now I'm using the minGW compiler in eclipse.
With this following code:
Book* book = xlCreateBook();
I get this error:
/src/xls2csv.cpp:22: undefined reference to `xlCreateBookCA'
Any help would be greatly appreciated :)
If we define a member function inside the class definition itself, is it necessarily treated inline or is it just a request to the compiler which it can ignore.
I'm looking at using SSE and I gather aligning data on 16byte boundaries is recommended. There are two cases to consider:
float data[4];
struct myystruct
{
float x,y,z,w;
};
I'm not sure the first case can be done explicitly, though there's perhaps a compiler option I could use? In the second case I remember being able to control packing in old versions of GCC several years back, is this still possible?
I am trying to declare a reuse identifier associated to a UITableView subclass in swift.
From my understanding I would like to declare an class stored property (not an instance one) so i have access via: MyCustomTableCell.ReuseIdentifer.
Here is what I was trying:
class MyCustomTableViewCell : UITableViewCell {
class let ReuseIdentifier = "MyCustomTableViewCellReuseIdentifier"
}
The compiler mentions that class attributes are not supported yet. How to declare such kind of constants associated to a class type in a clean way?
As far as I know there is no web browser with built in validators for HTML, CSS and Javascript. Developing web pages without validation is like using a compiler that doesn't do syntax analysis. Even Firefox with its excellent plugins aimed at developers like Firebug lacks plugins for CSS and Javascript validation. Wouldn't it be useful to have these plugins? Am I missing something?
Is there a benchmark available how much relative time each instruction costs in a single-thread, average-case scenario (either with or without JIT compiler), for the JVM (any version) by Sun?
If there is not a benchmark already available, how can I get this information?
E.g.:
TIME
iload_1 1
iadd 12
getfield 40
etc.
Where getfield is equivalent to 40 iload_1 instructions.
I have an abstract class with a pure virtual function f() and i want to create a class inherited from that class, and also override function f(). I seperated the header file and the cpp file.
I declared the function f(int) in the header file and the definition is in the cpp file. However, the compiler says the derived class is still abstract.
How can i fix it?
I have converted a PowerBuilder application to 11.5 .NET. When it builds, it compiles into a DLL, an EXE and a bunch of “netmodule” files. Are the netmodules necessary for deployment, or just part of some intermediate step? Is there any way to get the compiler to build me one DLL for each pbl (PowerBuilder library)?
how does compiler determine there is run-time error ?
is it run the code and then decide whether code executable or not
are there any program which are capable to determine complexity of my executable code?
are there any code which is for measuring the time when code start to execute up to finish
I want to modify csharp-mode.el so that it includes the appropriate error regex's (regexi?) for the .NET csc.exe compiler.
How should a well-behaved progmode do this?
A classes Type metadata can be obtained in several ways. Two of them are:
var typeInfo = Type.GetType("MyClass")
and
var typeInfo = typeof(MyClass)
The advantage of the second way is that typos will be caught by the compiler, and the IDE can understand what I'm talking about (allowing features like refactoring to work without silently breaking the code)
Does there exist an equivalent way of strongly referencing members/properties/methods for metadata and reflection? Can I replace:
var propertyInfo = typeof(MyClass).GetProperty("MyProperty")
with something like:
var propertyInfo = property(MyClass.MyProperty)
Writing out a Scala class and problem here is that the compiler thinks that the code is a unit not returning the proper value. It's a method used to set a property in the class:
def setObject(`object`:StripeObject):StripeObject = {
this.`object` = `object`
}
The error is: type mismatch; found : Unit required: com.stripe.StripeObject
The full class is:
case class EventData(var previousAttributes: HashMap[String,Object], var `object`:StripeObject) extends StripeObject {
def getPreviousAttributes = {
previousAttributes
}
def setPreviousAttributes(previousAttributes: HashMap[String, Object]) = {
this.previousAttributes = previousAttributes
}
def getObject = {
`object`
}
def setObject(`object`:StripeObject):StripeObject = {
this.`object` = `object`
}
}
How do I make sure it doesn't return a Unit?
For example concept of Templates in C++ are for comfort as compiler generates some additional code, for your class or for your function, isn't it? So we could live without template by doing some additional (manual work).
What about virtual functions???
Are there any situations where both of them are irreplaceable?
Being stuck with a scala 2.9 compiler bug I've decided to try moving to Scala 2.10 RC. As a part of the switch I was trying to install SBT 0.13 snapshot.
The official web page lists a broken link:
http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt//0.13.0-SNAPSHOT/sbt.tgz
There is nothing about 0.13 in the directory, the link gives Error 404.
Any ideas about where to get the file?
HI everyone,
during the various stages of compilation in C or C++, i know that an object file gets generated.
i.e., any_name.o file.
what does thos .o file contain actually.
i cant open it since its a binary file.
Could anybody please help me?
are the contents of the object file mainly Dependant on the compiler which we use on unix?
I'm using the 3.5 library for microsoft code contracts
public object RetrieveById(int Id)
{
Contract.Ensures(newObject != null, "object must not be null");
return newProject;
//No error message if I move the Contract.Ensures to here
//But it isn't asserting/throwing a contract exception here either
}
I get the compiler message:
"Error 18 Contract section within try block in method 'Controller.RetrieveById(System.Int32)'
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"My_TableView"])
{
MyTableViewController *destViewController = segue.destinationViewController;
destViewController.data = data;
}
}
Hi, I have a problem doing a segue (modal) between a ViewController to a TableViewController.
The name of the segue between the ViewController and the NavigationController is "My_TableView".
Compiler gives me this error:
unrecognized selector sent to instance 0x9275b50
what's the problem?