Top "Literals" questions

a notation for representing fixed values in source code

Why can I compare a String to a &str using if, but not when using match?

I'm trying to implement a function that reads command line arguments and compares them to hard-coded string literals. When I …

string rust match literals
How do I write a map literal in C++11?

In Python, I can write a map literal like this: mymap = {"one" : 1, "two" : 2, "three" : 3} How can I do the equivalent …

c++ c++11 map literals
Does Kotlin have a syntax for Map literals?

In JavaScript: {foo: bar, biz: qux}. In Ruby: {foo => bar, biz => qux}. In Java: HashMap<K, V&…

dictionary kotlin literals
Powershell SqlCmd - Using result values without defining variables

I am wondering if there is any way to use values for a dataset in a subsequent query. Here is …

sql variables powershell literals sqlcmd
Are there binary literals in Java?

I want to declare my integer number by a binary literal. Is it possible in Java?

java syntax binary literals
Passing Array to Python Spark Lit Function

Let's say I have a numpy array a that contains the numbers 1-10. So a is [1 2 3 4 5 6 7 8 9 10]. Now, I also have …

python apache-spark pyspark literals pyspark-sql
When did C++ compilers start considering more than two hex digits in string literal character escapes?

I've got a (generated) literal string in C++ that may contain characters that need to be escaped using the \x …

c++ string escaping literals
Is there a best practice for writing maps literal style in Java?

In short, if you want to write a map of e.g. constants in Java, which in e.g. Python …

java class object map literals
nested struct initialization literals

How can I do this: type A struct { MemberA string } type B struct { A MemberB string } ... b := B { MemberA: "test1", …

struct go nested literals
Why write 1,000,000,000 as 1000*1000*1000 in C?

In code created by Apple, there is this line: CMTimeMakeWithSeconds( newDurationSeconds, 1000*1000*1000 ) Is there any reason to express 1,000,000,000 as 1000*1000*1000? Why not 1000^3 …

objective-c c integer literals