Ambiguity can refer to two related concepts: 'ambiguous calls' and 'ambiguous grammars'.
Questions tagged [ambiguity]
400 questions
9
votes
1 answer
Normalizing structural differences in grammars
Consider the following grammar:
S → A | B
A → xy
B → xyz
This is what I think an LR(0) parser would do given the input xyz:
| xyz → shift
x | yz → shift
xy | z → reduce
A | z → shift
Az | → fail
If my assumption is…

thwd
- 23,956
- 8
- 74
- 108
9
votes
6 answers
Java do while, while
what behaviour can I expect when I run this code:
do while(testA) {
// do stuff
} while(testB);
Will it behave like:
do {
while(testA) {
// do stuff
}
} while(testB);
Or:
if(testA) {
do {
// do stuff
}…

Pindatjuh
- 10,550
- 1
- 41
- 68
8
votes
1 answer
why does ptr_fun find this ambiguous even when template parameters are given?
So, here is some basic code which illustrates my question:
#include
int func(int x) {
return x;
}
int func(int x, int y) {
return x + y;
}
int main() {
std::ptr_fun(func);
}
We have 2 overloads for a function…

Evan Teran
- 87,561
- 32
- 179
- 238
8
votes
1 answer
template disambiguator
I'm trying to find any information about template keyword used as disambiguator, but there is nothing about that. Probably I'm searching wrong keywords, but there is nothing like .template or ->template in standard. Google shows only GCC problems…

confucius
- 409
- 3
- 11
8
votes
3 answers
Algorithms or data structures for dealing with ambiguity
I'm looking for algorithms or data structures specifically for dealing with ambiguities.
In my particular current field of interest I'm looking into ambiguous parses of natural languages, but I assume there must be many fields in computing where…

hippietrail
- 15,848
- 18
- 99
- 158
7
votes
2 answers
How to get rid of this ambiguity?
I am pretty sure this has been asked before, however I was unable to find the right answer:
I tried to eliminate the ambiguity in the following exemplary code snippet:
{-# LANGUAGE MultiParamTypeClasses #-}
class FooBar a b where
foo :: a -> a
…

julx
- 8,694
- 6
- 47
- 86
7
votes
5 answers
Why do these two constructors together not produce an ambiguity error?
Consider the following:
class A
{
private:
A() {}
public:
A(int x = 0) {}
};
int main()
{
A a(1);
return 0;
}
I have two constructors, one is a default and the other one is converting constructor with a default argument. When I…

Ron_s
- 1,429
- 1
- 14
- 24
7
votes
11 answers
How do you resolve ambiguities in specification?
I need some advice on how to resolve ambiguities within application specifications.
As one simple example,
When a user fails to authenticate after a number of times, send a notification to IT.
In the above example, it is not clear how many times…

dance2die
- 35,807
- 39
- 131
- 194
7
votes
2 answers
C++ compilation error: cannot convert from B to A, no constructor, or constructor overload ambiguity
I have some code which implies a type conversion, which does not compile although there is a conversion method...
class A
{
public:
A(void) :_m(0) { }
A(int val) : _m(val) {}
private:
int _m;
};
class B
{
public:
B(void) : _m(0) {}
…

pascal
- 3,287
- 1
- 17
- 35
7
votes
8 answers
Why can't .Net / C# understand interface inheritance with properties of the same name?
Consider the following class and interfaces:
public interface A { string Property { get; set; } }
public interface B { string Property { get; set; } }
public interface C : A, B { }
public class MyClass : C
{
public…

Kees C. Bakker
- 32,294
- 27
- 115
- 203
7
votes
3 answers
Ambiguous XML schema
I'm trying to produce a pretty simple XML schema for an XML similar to the following:
-
-
-
…

Dana
- 2,619
- 5
- 31
- 45
7
votes
3 answers
what is the expected behavior?
Below is a purely academically invented class hierarchy.
struct X{
void f1();
void f2();
void f3();
};
struct Y : private X{
void f4();
};
struct Z : X{
};
struct D : Y, Z{
using X::f2;
using…

Chubsdad
- 24,777
- 4
- 73
- 129
7
votes
1 answer
Can an Android View's id be safely shared across multiple Activities?
Say I have two Activities in an Android application, EditPerson and EditEmployee.
It would seem natural to have the EditPerson Activity be a base class for the EditEmployee Activity and define methods that marshal data to and from the Views defined…

el2iot2
- 6,428
- 7
- 38
- 51
7
votes
3 answers
Object construction/Forward function declaration ambiguity
Observation: the codes pasted below were tested only with GCC 4.4.1, and I'm only interested in them working with GCC.
Hello,
It wasn't for just a few times that I stumbled into an object construction statement that I didn't understand, and it was…

Gui Prá
- 5,559
- 4
- 34
- 59
7
votes
8 answers
Ambiguity of function overloading - Integers vs. Doubles
Suppose I wish to have 2 functions, one that generates a random integer within a given range, and one that generates a random double within a given range.
int GetRandomNumber( int min, int max );
double GetRandomNumber( double min, double max…

Anonymous
- 4,167
- 11
- 47
- 52