Questions tagged [language-specifications]
126 questions
5
votes
4 answers
Is "'" identical to "\'" as per the C/C++ standard?
int main()
{
char* str1 = "Tom's cat";
char* str2 = "Tom\'s cat";
}
The code can be compiled with VS 2015.
I just wonder:
Are both of the two ways compliant to the C and/or the C++ standard?

xmllmx
- 39,765
- 26
- 162
- 323
5
votes
2 answers
When can a generic parameter never be null
In a generic GetHashCode(T foo) method, I check whether foo is null.
However I just stumbled upon a strange Resharper warning.
In the following code, can foo never be null?
private class FooComparer : IEqualityComparer where T: Foo
{
…

HugoRune
- 13,157
- 7
- 69
- 144
4
votes
1 answer
Why is the variable in a for...in loop a string?
I was using for...in loops to log values, and I noticed that the variable in a for...in loop (i, in this case) is a string.
for (var i in ['a', 'b', 'c']) {
console.log(i, typeof i)
}
I searched the ECMAScript specifications, in the section…

shreyasm-dev
- 2,711
- 5
- 16
- 34
4
votes
4 answers
C language semantic specification
Wikipidea says that Perl has a dominant implementation that is used as a reference for its specification ,while C language is specified by the standard ANSI ISO.
I learnt C language without reading a single line of the standard, is that normal...?…

user591931
- 239
- 2
- 3
- 10
4
votes
2 answers
Blogger template language specifications
Is there somewhere google published the official blogger template language specifications? I read this question and it provided a lot of useful information, but it didn't provide me with help on a particular tag I'm looking for (the variable tag).

helloworld922
- 10,801
- 5
- 48
- 85
4
votes
2 answers
How to efficiently ensure a decimal value has at least N decimal places
I want to efficiently ensure a decimal value has at least N (=3 in the example below) places, prior to doing arithmetic operations.
Obviouly I could format with "0.000######....#" then parse, but it's relatively inefficient and I'm looking for a…

Joe
- 122,218
- 32
- 205
- 338
4
votes
2 answers
"At least one" in C standard translation limits specification
(This question was prompted by an answer to this previous question)
The C11 standard makes use of the following formulation when discussing the complexity of programs which a compliant compiler should be able to support:
5.2.4.1 Translation…

R.M.
- 3,461
- 1
- 21
- 41
4
votes
1 answer
Why plus operator in Java always produces Integer?
I have code like this
short a = 1;
short b = 2 ;
short c = a + b; // dosen't compile
What is the reason for compilation failure? x + x always produces Integer or bigger Number, but why?

MariuszS
- 30,646
- 12
- 114
- 155
3
votes
1 answer
F# Specification Symbolic Operator VS Symbolic Keyword
I am reading in the F# specification - the most recent one that I could find, found here - in an effort to learn the language in what is arguably the hard way. In section "3.6 Symbolic Keywords," the specification states that:
The following…

leviathanbadger
- 1,682
- 15
- 23
3
votes
0 answers
How to use "with" keyword in a copy constructor in C#?
Not long ago I got familiar with with operator.
Based on MSDN, when using the "with expression", reference types will be copied, but that logic can be changed by overriding copy constructor.
In the case of a reference-type member, only the…

David Oganov
- 976
- 1
- 11
- 23
3
votes
0 answers
Why is the C# 9.0 "with expression" exclusive to records?
Reading through the spec for C# 9.0 I came across record and the new with expression. Immediately I thought this was great for all my immutable structs, such as vectors and matrices! However it turns out that the with expression only works on…

Charanor
- 810
- 8
- 23
3
votes
1 answer
How to understand this spec text?
I want to improve my knowledge about Golang by reading the Golang specification but English isn't my native language; and, I do not fully understand what the following text means:
Source code is Unicode text encoded in UTF-8. The text is not…

defaultprogr
- 51
- 5
3
votes
1 answer
Which mechanism knows the entry point of a program is main()
How does an application program know its entry point is the main() function?
I know an application doesn't know its entry point is main() -- it is directed to main() function by means of the language specification whatever it is.
At that point,…

Nazim
- 406
- 1
- 6
- 20
3
votes
1 answer
Why does the Type class have a method called IsPrimitive() if the C# spec refers to them as simple types?
Looking at the C# 6.0 Draft specification I saw nothing about primitive types; I only saw data about Simple types. That said, the Type class has an IsPrimitive method.
Should IsPrimitve really be IsSimple?

IEnjoyEatingVegetables
- 968
- 3
- 11
- 30
3
votes
3 answers
C# language specification "Program Instantiation" appears to be mis-identified
In the C# language specification a Program is defined as
Program the input to the compiler.
While an Application is defined as
Application an assembly that has an entry point
But, they define
Program instantiation — the execution of an…

P.Brian.Mackey
- 43,228
- 68
- 238
- 348