Hi,
Could any one tell me how to convert a unsigned long value into string
(char *) ?
In C++ there is a function _ultoa so wanted a similar one in C .
Regards,
Shivaraj
Feb 24 '08
107 25835
John Bode wrote:
On Feb 26, 1:26 pm, Richard <de...@gmail.comwrote:
I'm deadly serious about this use of sizeof.
In my 18 years of programming at 6 different companies, I've never
heard anyone rant about sizeof in this manner.
Richard is troll, which is why I killfiled him long ago. He'll "rant"
about anything that he thinks will cause trouble on the newsgroup. It's
best to ignore him if at all possible.
Brian
On Feb 27, 1:43 pm, "Default User" <defaultuse...@yahoo.comwrote:
John Bode wrote:
On Feb 26, 1:26 pm, Richard <de...@gmail.comwrote:
I'm deadly serious about this use of sizeof.
In my 18 years of programming at 6 different companies, I've never
heard anyone rant about sizeof in this manner.
Richard is troll, which is why I killfiled him long ago. He'll "rant"
about anything that he thinks will cause trouble on the newsgroup. It's
best to ignore him if at all possible.
Brian
I don't see him as a troll like Twink and McCormack; he strikes me as
someone who could contribute meaningfully to the group if he just got
over himself.
On Feb 27, 1:47 pm, Richard <de...@gmail.comwrote:
William Pursell <bill.purs...@gmail.comwrites:
>
Would you like to see
printf "hello%s" "world";
or something equally as contrived for example?
I would much rather see:
printf "hello %s\n" "world";
Which, BTW, is actually valid in at least one major language:
$ printf "hello %s\n" "world"
hello world
Ben Bacarisse wrote:
Richard <de***@gmail.comwrites:
.... snip ...
>
>My experience is that almost nowhere other than here have I seen "sizeof x + y" used in preference to "sizeof(x)+y";
I don't have much code here to scan, but my Linux kernel source
has more than 1200 instances of this form of sizeof. Much less
than the other form, but my point in not about the frequency of
use, but about your insistence than anyone who thinks differently
about is being silly (that is from another post in this thread).
I simply use "y + sizeof x" to avoid reading problems. Similarly I
use "N * sizeof *p".
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
In article <47***************@news.sbtc.net>, cr*@tiac.net (Richard Harter) wrote:
>On Wed, 27 Feb 2008 15:25:06 GMT, sp******@milmac.com (Doug Miller) wrote:
>>In article <fq**********@registered.motzarella.org>, Richard <de***@gmail.com>
wrote:
>>
>>>For starters theres the
"is it sizeof(x)+y" or "sizeof(x+y)" double take.
Don't be ridiculous; the meaning is just as obvious as in x = y * a + b;
Or do you look at that statement and have trouble deciphering whether the right side means ((y * a) + b) or (y * (a + b)) ?
I dunno, I would expect that for most people it is not "just as obvious". That * binds more closely than + is customary usage in basic algebra. C (and most other computer languages) uses the same precedence rules as ordinary usage. "sizeof" is an operator peculiar to C; its precedence is necessarily idiosyncratic.
I disagree with respect to the degree of "obviousness" -- even if sizeof and +
were at the *same* level of precedence, left-to-right evaluation would still
guarantee that "sizeof x + y" would mean "(sizeof x) + y". It takes (IMHO) a
deliberately obtuse interpretation to suppose that it could mean "sizeof (x +
y)" instead.
--
Regards,
Doug Miller (alphageek at milmac dot com)
It's time to throw all their damned tea in the harbor again.
Richard <de***@gmail.comwrites:
Would you like to see
printf "hello%s" "world";
or something equally as contrived for example?
I suggest that your learn about some other programming languages. For
example Haskell or one of the ML familly.
Yours,
--
Jean-Marc sp******@milmac.com (Doug Miller) writes:
In article <47***************@news.sbtc.net>, cr*@tiac.net (Richard Harter) wrote:
On Wed, 27 Feb 2008 15:25:06 GMT, sp******@milmac.com (Doug
Miller) wrote:
>In article <fq**********@registered.motzarella.org>, Richard <de***@gmail.com>
wrote:
> For starters theres the
"is it sizeof(x)+y" or "sizeof(x+y)" double take.
Don't be ridiculous; the meaning is just as obvious as in
x = y * a + b;
Or do you look at that statement and have trouble deciphering whether the right side means ((y * a) + b) or (y * (a + b)) ?
I dunno, I would expect that for most people it is not "just as
obvious". That * binds more closely than + is customary usage in
basic algebra. C (and most other computer languages) uses the
same precedence rules as ordinary usage. "sizeof" is an operator
peculiar to C; its precedence is necessarily idiosyncratic.
I disagree with respect to the degree of "obviousness" -- even if sizeof and +
were at the *same* level of precedence, left-to-right evaluation would still
guarantee that "sizeof x + y" would mean "(sizeof x) + y". It takes (IMHO) a
deliberately obtuse interpretation to suppose that it could mean "sizeof (x +
y)" instead.
If the grammar was changed in the obvious way so that sizeof x + y meant
sizeof(x+y), sizeof(x) + y would also be interpreted as sizeof((x)+y). BTW
sizeof(x)->field currently mean sizeof((x)->field).
Yours,
--
Jean-Marc
In article <fp**********@registered.motzarella.org>,
Richard <de***@gmail.comwrote:
>"J. J. Farrell" <jj*@bcs.org.ukwrites:
>Richard wrote:
>>Richard Heathfield <rj*@see.sig.invalidwrites:
... char s[(CHAR_BIT * sizeof n + 2) / 3 + 1];
I hate this "fad" of using "sizeof n". It reads horribly.
What ""fad""? sizeof and its usage has been part of C for a long time.
The fad that I have almost never seen it in production code because .... it reads horribly. Simple. Practical reasons. The clique here use it all the time because they are the clique.
Richard - face it. For the in-crowd, using parens with sizeof is like
mixing primaries during daylight hours. Not done.
(We'll see if anyone catches the reference. Free peppermint candy to
anyone who does) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ramesh |
last post by:
Hi,
I need to convert unsigned long data to a std::string, I googled a bit
to see if the string class supports any methods to achieve this - but
didnt find any, I think of using sprintf and...
|
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: 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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
| |