I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree
with me, then what do you think it is?
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell 11 1684
Doesn't 0 mathematically mean 0 (zero, null, nil) in decimal, binary,
hexadecimal, etc whatever number system you can devise?
Ben
benben wrote: Doesn't 0 mathematically mean 0 (zero, null, nil) in decimal, binary, hexadecimal, etc whatever number system you can devise?
Ben
I'm speaking strictly in lexical terms. How would a C++ grammarian classify
0? I believe you are correct regarding semantics.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Steven T. Hatton wrote: I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree with me, then what do you think it is?
A naked 0 is a octal-literal according to the C++ standard.
A decimimal literal is a single non-zero digit followed
by zero or more digits.
Ron Natalie wrote: Steven T. Hatton wrote: I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree with me, then what do you think it is?
A naked 0 is a octal-literal according to the C++ standard. A decimimal literal is a single non-zero digit followed by zero or more digits.
It's probably a completely pointless observation, but that's also how I
understood §2.13.1.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
"Steven T. Hatton" <ch********@germania.sup> schrieb im Newsbeitrag
news:lK********************@speakeasy.net... benben wrote:
Doesn't 0 mathematically mean 0 (zero, null, nil) in decimal, binary, hexadecimal, etc whatever number system you can devise?
Ben I'm speaking strictly in lexical terms. How would a C++ grammarian
classify 0? I believe you are correct regarding semantics.
You have to use a type qualifier. So it depends on you.
I think
(char) 0
would be valid as well. But I didn't check it.
Matthias
As much as I think this is pointless, this might solve the argument,
sort of:
std::cout << typeid(0).name();
Starfox wrote: As much as I think this is pointless, this might solve the argument, sort of:
std::cout << typeid(0).name();
Not really, because an octal integer literal will result in the creation of
a temporary of type int.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jack Klein wrote: On Sat, 23 Jul 2005 06:38:41 -0400, "Steven T. Hatton" <ch********@germania.sup> wrote in comp.lang.c++:
I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree with me, then what do you think it is?
I think you are wasting the group's time playing with silly newbie exercises. Suppose some particular compiler gets it wrong, and parses it as a decimal literal. How could you tell the difference?
..
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree with me, then what do you think it is?
In my opinion, naked zero must be a separate lexical token (from compilers
point of view).
If not, why is it possible to initialize pointers
by zero:
some_type* p=0;
//or something like this:
class a
{
some_type* pointer;
a(): pointer(0) {}
};
Initializing pointers by integral value is
not permitted; you cant write pointer(13).
Long time ago there existed something like
NULL, which is now depreciated in ANSI c++.
Instead of that you use 0 - so it must be
something different than any integral number
(regardless of octal, decimal, hex, etc).
O.C.
Tescobar wrote: I say no, 0 is _not_ a decimal literal. Anybody disagree? If you do agree with me, then what do you think it is?
In my opinion, naked zero must be a separate lexical token (from compilers point of view).
It is not. It is an octal integer literal. If not, why is it possible to initialize pointers by zero:
some_type* p=0;
Because the standard says that a null pointer constant is
a constant integer expression evaluating to zero. It doesn't
have to the 0 token. It can be any constant integer expression
with value zero:
some_type* p = 3-3;
is perfectly valid. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Bentley |
last post by:
John Bentley:
INTRO
The phrase "decimal number" within a programming context is ambiguous. It could
refer to the decimal datatype or the related but separate concept of a generic
decimal number....
|
by: Peter Blatt |
last post by:
Does 5 represent the total numer of digits (including the fractional portion) or only the number of places
BEFORE the decimal point? Moreover does the number include the decimal point?
Are there...
|
by: hana1 |
last post by:
Hello experts,
I used to program in C/C++ and now switched to Java. I am having a
difficulty that I need your help with. How can I limit a double variable to
hold 2 decimal points only? Say I...
|
by: italia |
last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal
Places = 6.
I had decimals in the original field. But after the transfer, the
digits after the decimals are gone.
Now...
|
by: ChrisM |
last post by:
Hi Guys,
I'm looking for a function that will return the lowest integer that is
greater than or equal to a decimal number.
eg.
3.1(decimal) returns 4(integer)
3.9(decimal) returns...
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
Is there a way to determine if a numeric value contains a decimal? how to do
this?
If IsNumeric(txt1.Text) then ... so now I know that txt1.Text is a numeric
value. How can I tell if it is a...
|
by: Frank Millman |
last post by:
Hi all
I have a standard requirement for a 'decimal' type, to instantiate and
manipulate numeric data that is stored in a database. I came up with a
solution long before the introduction of the...
|
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= |
last post by:
Hi,
Why does Math.Sqrt() only accept a double as a parameter? I would think
it would be just as happy with a decimal (or int, or float, or ....). I can
easily convert back and forth, but I am...
|
by: Terry Reedy |
last post by:
Gerhard Häring wrote:
The new fractions module acts differently, which is to say, as most
would want.
True
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
F(1.0)...
|
by: Jason |
last post by:
I'm making a program that will convert decimal inputs (in this case, in
inches) and output a fractional answer. At the moment, I'm only able to
output the fractional answer in three parts: A whole...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |