(OT?) A comment question about correct English usage

Mar 26, 2014 10 Replies

I was just writing a comment as I have been doing last 30 years or so and I was unsure whether to say "from" or "of" or something else.



The text is: "Allocate memory either from the system or from a passed container" .



While it is obvious and will likely work for anybody I am unsure about the "from", is it correct? If not what should it be?



Thanks,



Dimiter



(back to the real programming/commenting with all the associated linguistic imperfections :D ).


------------------------------------------------------ Dimiter Popoff, TGI

formatting link



------------------------------------------------------

formatting link


I would write "Allocate memory from either the system or a passed container".

mvh.,

David

Thanks David,

sounds much better. Ordering seems even harder to get right than choosing between "from" "of" etc. .... :-) .

Dimiter

The "from" is quite correct.

There's a slightly different form where "of" is correct:

Allocate a block _of_ something.

In that case, it is grouped like this

Allocate (a block of something).

verb direct-object

In your case it's

Allocate (memory) from (the system)

verb direct-object indirect-object

In the former case, the phrase that constitutes the direct-object contains another preposition and object that implies the the source of the direct-object. In the latter case, the indirect-object specifies the source of the direct-object specifically.

Grant Edwards grant.b.edwards Yow! Oh, I get it!! at "The BEACH goes on", huh, gmail.com SONNY??

"of" implies a subtype or subset relationship, e.g. give me a piece of chocolate. "from" implies the source, e.g. give me a biscuit from the packet

Hence your sentence means there are two different places (or maybe APIs) from which the memory can be allocated.

The "either from ... or from ..." is good and explicit since it reinforces that there are equally valid alternatives.

It is fine. You could leave out the second "from" as someone suggested, but it's less ambiguous the way you wrote it. I'd leave it the way it is.

"From" is, indeed, correct. "Of" would sound really wrong here; it would trip up the native English speaker, but he'd probably figure out your meaning after a while.

Tim Wescott Control system and signal processing consulting www.wescottdesign.com

Thanks to everyone who replied. I left the sentence as it was, I knew it would work, I asked because I was somewhat surprised by my uncertainty about something seemingly simple. The thing is that words like "from", "of" etc. have direct translations into other languages but they often overlap, e.g. in German "from" can be "von" but so can be "of"... (hopefully I get this right, I don't use a Bulgarian - my native - analogy for obvious reasons, I guess I am the only one here to speak the language).

Now to beat this a little more in a somewhat more on topic direction, is the "container" word commonly used nowadays? Above, it means an object which would be asked to allocate memory (in DPS there are runtime dynamically found/loaded objects, one of these, typically a memory_pool type I have). (OK, deallocate memory it has previously allocated). If no container object is passed (by passing a 0) the request will be made via a system call, the lowest level allocate/deallocate, getting a multiple of 4k (the cluster being 1 MMU page). The memory_pool type can come with various cluster lengths, it is normally (always so far?) allocated from the system memory. I think I got to the "container" word by seeing it used by some browser, something like "plugin container" or sort of, not that I know what this means in their context beyond what would be obvious to most of us here :-).

Dimiter

------------------------------------------------------ Dimiter Popoff, TGI

formatting link

------------------------------------------------------

formatting link

Prepositions like this are hard exactly because the meanings overlap, but don't quite match. That, and the fact that it's hard to pin down exactly what they do mean -- in your native language, you just know.

This reminds me of a friend of mine in college, who was learning German, French, and Serbian all at the same time. For about a week she totally lost her ability to correctly use prepositions in any language "Hey! let's go over the street at that restaurant over there!". This probably meant that her brain was rearranging itself to accommodate prepositions in any language (lucky girl). It was certainly interesting to watch.

When I think of it at all, I think of "container" as being a specific sort of object, such as are defined in the C++ standard template library. Your sentence certainly made 100% sense to me with that word in there -- I took it to mean that you've got a class that allocates its own bits of memory, and you're passing a pointer to it.

Tim Wescott Control system and signal processing consulting www.wescottdesign.com

OK, thanks - apparently the word has been commonly used for decades, it is just me now discovering it. No huge surprise, given that I live in my own programming universe :-). Good thing I have picked its right meaning - it was intended to be exactly the one you got.

Dimiter

------------------------------------------------------ Dimiter Popoff, TGI

formatting link

------------------------------------------------------

formatting link

Well, /one/ of the many "right" meanings :(

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required