Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to write ANY value

Reply
Thread Tools

How to write ANY value

 
 
Anders Wegge Keller
Guest
Posts: n/a
 
      02-23-2011
Keith Thompson <(E-Mail Removed)> writes:

> Anders Wegge Keller <(E-Mail Removed)> writes:
> [...]
>> In the general case, adress 0x0842 has no universal meaning beyond
>> beaing an address. Thus, we never get to the point of having to worry
>> about different compilers ways with memory access.

> [...]
>
> In the general case, 0x0842 is not an address at all; it's of
> type int. It can be *converted* to some pointer type, and such
> a conversion is "intended to be consistent with the addressing
> structure of the execution environment".


Sorry for not being nit-picky enough do write (unsigned char
*0x0842). Quoting one of my colleagues, when we were at a Coccinelle
workshop "We're not C-linguists. We just use the language".

> We often refer to things like " address 0x0842", but that's either a
> convenient verbal shorthand for the above conversion, or something
> outside the scope of the C language. (Address 0x0842 might well
> be a meaningful concept in the context of a particular CPU.)


A lot of the things we do with C *is* outside the language proper. At
least, that's the case for me, and I expect that more and more of the
remaining C development is targeted at either freestanding
implementations in toasters etc. or low-level bit banging.

That will give some imprecise language that isn't proper in this
group, but please bear with me. I'm doubly challenged by also not
being a native english speaker.

--
/Wegge

Leder efter redundant peering af dk.*,linux.debian.*
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      02-24-2011
On 2/23/2011 4:00 PM, Anders Wegge Keller wrote:
> [...]
> A lot of the things we do with C *is* outside the language proper.


Yes, and the Rationale recognizes this explicitly. So does the
Standard itself, albeit only in non-normative material.

There is nothing -- *nothing* -- wrong with crossing the line
between fully portable C and system-specific C. In my opinion, it
is both common and laudable to cross that line at need. But in my
opinion it is also important to know where the line is, to know what
parts of the code will require effort to port and what parts will
"port themselves," and to take appropriate precautionary measures.
Like, for example, wrapping those `volatile' pointer-from-integer
constructs inside easily-segregated functions instead of just letting
them float free throughout the code. You questioned BartC's advice
to "be wary" of raw access to memory-mapped registers; I think his
wariness is good engineering practice.

> At
> least, that's the case for me, and I expect that more and more of the
> remaining C development is targeted at either freestanding
> implementations in toasters etc. or low-level bit banging.


I betcha, I betcha, I betchamillionbucks that next year's toaster
will use a different CPU. Quite likely (but not certainly) a CPU in
the same family as this year's, but enhanced/cost-reduced/spiffed-up
in some way or other. And, lo! the code will have to be ported.

We have arrived at a situation where "soft"ware is something of a
misnomer. It used to be "soft" because it was malleable, it could be
changed cheaply without modifying the expensive and hard-to-change
hardware that it ran on. Well, nowadays the "hard"ware changes have
become faster than they were, while "soft"ware changes have grown more
and more difficult. An investment in "soft"ware can only be justified
if it can be amortized over several generations of "hard"ware -- or, in
short, your code *will* be ported. If you do not prepare for that
inevitability, you make yourself a net resource drain and not a net
contributor.

As for bit-banging -- well, I liked your earlier message about
"bit-baning" better! Bits have been the bane of most of us, and I
imagine they'll continue to be so.

(A European colleague once gave me his business card, which
described him as a "System-Berater," a German title we might render in
English as "System Advisor" or "System Consultant." But the English
verb "berate" means to scold or chastise, and I immediately pictured
the fellow wagging an admonitory forefinger at a recalcitrant computer
and saying "Bad system! Baaadddd system! No dessert for you!!!")

> That will give some imprecise language that isn't proper in this
> group, but please bear with me. I'm doubly challenged by also not
> being a native english speaker.


Anders, your English is one helluvalot better than my Norwegian!
There's a saying: If you speak many languages you're "multilingual,"
if you speak two languages you're "bilingual," and if you speak one
language you're "American."

--
Eric Sosman
http://www.velocityreviews.com/forums/(E-Mail Removed)d
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
How to use Response.write to write to a specific area on a aspx pa =?Utf-8?B?QWJlbCBDaGFu?= ASP .Net 6 05-03-2006 10:16 PM
DVD Write speed - Not able to write at 8 speed Vincent Wonnacott Computer Support 1 09-16-2004 03:14 PM
How to open a new console and write something out write printf() Peter Hansen C++ 1 08-24-2003 11:49 AM



Advertisments