If I add a backslash+space to the start of double and single quoted strings, I get different results:
"\ text"
'\ text'
In the output for the double quoted string I see only a space.
In the output for the single quoted string I see…
When I try to assign an 128-bit integer in gcc 4.9.1, I get a warning: integer constant is too large for its type.
Example Code
int main(void) {
__uint128_t p = 47942806932686753431;
return 0;
}
Output
I'm compiling with gcc -std=c11 -o test…
For example:
// This will become either SomeMethodA or SomeMethodW,
// depending on whether _UNICODE is defined.
SomeMethod( _T( "My String Literal" ) );
// Becomes either AnotherMethodA or AnotherMethodW.
AnotherMethod( _TEXT( "My Text" ) );
I've…
I've been doing c# for a long time, and have never come across an easy way to just new up a hash.
I've recently become acquainted with the ruby syntax of hashes and wonder, does anyone know of a simple way to declare a hash as a literal, without…
Both GCC and Clang do not complain if I assign a string literal to a char*, even when using lots of pedantic options (-Wall -W -pedantic -std=c99):
char *foo = "bar";
while they (of course) do complain if I assign a const char* to a char*.
Does…
I've got a long string literal in Go:
db.Exec("UPDATE mytable SET (I, Have, Lots, Of, Fields) = ('suchalongvalue', 'thisislongaswell', 'ohmansolong', 'wowsolong', 'loooooooooooooooooooooooooong')")
I see two ways to make this more manageable: raw…
How can I get the literal value out of a Literal[] from typing?
from typing import Literal, Union
Add = Literal['add']
Multiply = Literal['mul']
Action = Union[Add,Multiply]
def do(a: Action):
if a == Add:
print("Adding!")
elif a…
In short, if you want to write a map of e.g. constants in Java, which in e.g. Python and Javascript you would write as a literal,
T CONSTANTS =
{
"CONSTANT_NAME_0": CONSTANT_VALUE_0 ,
"CONSTANT_NAME_1": CONSTANT_VALUE_1 ,
…
Look at this code snippet:
int a = 0xe+1;
Clang, gcc, icc don't compile this:
t.cpp:1:12: error: invalid suffix '+' on integer constant
MSVC successfully compiles.
Which compiler is correct? If clang and gcc are correct, why is this…
Hello I am trying to understand how Python's pass by reference works.
I have an example:
>>>a = 1
>>>b = 1
>>>id(a);id(b)
140522779858088
140522779858088
This makes perfect sense since a and b are both referencing the same value that they would…
In the C++-Standard (eg. N4594) there are two definitions for operator""s:
One for std::chrono::seconds :
namespace std {
...
inline namespace literals {
inline namespace chrono_literals {
// 20.15.5.8, suffixes for duration literals
constexpr…
I am new to C# and want to understand how values work. If I look at a normal integer value, it has 3 important parts in it: the type, name and value.
int testInt = 3;
| | |
Type Name Value
But when I see a float value it confuses me a…
Please look at following two code:
public static void main(String... args)
{
System.out.println(0.5==0.5f);
}
Output : true
public static void main(String... args)
{
System.out.println(0.1==0.1f);
}
Output: false
Why is it happening so?