Questions tagged [literals]

a notation for representing fixed values in source code

External links

1554 questions
-1
votes
1 answer

c++ passing float as reference between objects and setting into struct gives :a member of reference type must be initialized

I have float variable witch its initial value is passed to function as reference. I need to set this reference value to struct that holds data. There is some work that is done and I need to get the updated value back. Here is the flow in pseudo…
user63898
  • 29,839
  • 85
  • 272
  • 514
-1
votes
1 answer

\\ string literal doesn't translate to \ backslash

I have a string "ABC DEF" and I would like to add "\s" in between the words to make it "ABC\sDEF" for XPath matches. String label = "ABC DEF"; String[] arrLabel = label.split("\\s+"); String matches = "\\s"; label=arrLabel[0]; for(int i = 1; i <…
sumiati
  • 9
  • 1
-1
votes
1 answer

Advantage Java Long Suffix

The Java Language specification (Section 3.10.1) states the following: An integer literal is of type long if it is suffixed with an ASCII letter L or l [...]; otherwise it is of type int (§4.2.1). So far so good, this means that the following…
Benjamin
  • 99
  • 8
-1
votes
1 answer

What is this called? And how to achieve it?

I would like to make a WRITE A NEW POST page similar to ASP.NET or how to make a page similar to https://stackoverflow.com/questions/ask Please note, I do not want reference to already made controls like free rich text editor, etc. I would like to…
user287745
  • 3,071
  • 10
  • 56
  • 99
-1
votes
2 answers

Which part of a Javascript statement is literal?

I know that fixed values are literals, and variable values are variables. If I have a simple statement such as: var car = "Audi"; does it contain a literal? To which part of the statement is the variable applied? Is it "Audi", as that can be…
-1
votes
2 answers

Converting an int to a double by multiplying by 1.0 or adding 1d?

As far as I know, to convert an integer to a double one can multiply the former by "1.0". It's apparently also possible to add "1d" (the double literal) to it. What, then, is the difference? Thanks!
aralar
  • 3,022
  • 7
  • 29
  • 44
-1
votes
1 answer

`arrayWithObjects` vs. new Literal syntax?

Can +[NSArray arrayWithObjects] and the newer, literal syntax produce different results? Is there any chance that the newer syntax produces different results? Example case is 3 literal strings: return [NSArray arrayWithObjects:@"one", @"two",…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
-1
votes
3 answers

In Java, how do you print out an anwer in a different literal?

I know that you add an L to a value if it exceeds the scope of an integer but you still have to print it as such. I understand the concept of doing it when you're just printing out a plain number. What about when you're using a defined variable…
itsmetheperson
  • 77
  • 1
  • 12
-1
votes
4 answers

strcpy vs memcpy for copying char * with known size

I don't care about the NULL terminator so I have two choices: strcpy(createTabStmt, "CREATE TABLE "); //shorter and more readable code Or memcpy(createTabStmt, "CREATE TABLE ", sizeof ("CREATE TABLE ") - 1); //faster? Is the memcpy version always…
cshu
  • 5,654
  • 28
  • 44
-1
votes
3 answers

difference between integer and decimal literals

85 // decimal 0213 // octal 0x4b // hexadecimal 30 // int 30u // unsigned int 30l // long 30ul // unsigned long I'm new to C++. What's the difference between int (30) and decimal (85) in this…
hanseN
  • 93
  • 1
  • 1
  • 7
-1
votes
7 answers

What's the easiest way to load a set of literal data in PHP?

I am building a small gallery that will only have 20 or so images in it. I'd like to have this data stored somewhere (even in the PHP file itself) and so am looking at ways of encoding the data as a literal or resource file. In JavaScript, I would…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
-1
votes
5 answers

How to declare bits in C?

I'm trying to do this : uint64_t key = 0110000010110110011001101111101000111111111010001011000110001110; Doesn't work. GCC says warning: integer constant is too large for its type Any idea why?
David 天宇 Wong
  • 3,724
  • 4
  • 35
  • 47
-1
votes
3 answers

can literals used without variable in c?

This question is little bit weird. Just out of curiosity, is it possible to use the literals without variable assignment in C ? Generally, we do like as follows, #include int main() { // Here we are using the literal '7' and assigning it…
Dinesh
  • 16,014
  • 23
  • 80
  • 122
-1
votes
1 answer

How do I pass a binary literal to JavaScript eval?

Before I start, please don't tell me not to use eval; I know the input is perfectly sanitary, so it's safe, fast, and easy. I'm using a JavaScript engine to power a calculator I've written in Java. To do this, I simply concatonate input into a…
Ky -
  • 30,724
  • 51
  • 192
  • 308
-1
votes
2 answers

CS0117: 'System.Web.UI.HtmlControls.HtmlAnchor' does not contain a definition for 'Text'

I received this error when trying to put a couple of C# projects live. The sites were working locally in VS 2010 but on live they threw the following error: CS0117: 'System.Web.UI.HtmlControls.HtmlAnchor' does not contain a definition for…
1 2 3
99
100