- Profanity in this channel - 7 Updates
- "Metaclasses: Thoughts on generative C++" 2017-07-26 by Herb Sutter - 1 Update
- read-only, write-only and read-write memory mapped I/O - 1 Update
- Equivalent unary operators for BSF and BSR - 1 Update
Real Troll <real.troll@trolls.com>: Jul 29 08:26PM -0400 On 29/07/2017 23:13, David Brown wrote: > I'd be surprised if it helped Mr. Flibble with his irritation over > Rick, however. If he is irritated by certain Rick then he should filter him out. In his case he is actually responding to him so there is a symptom of mental problem. >> are displaying here. > I was going to take exception to this comment - then I noticed the > name of the poster! Well research has shown that gay men and women have serious mental problems. Even that openly known homosexual by the name of Stephen Fry had some mental problem and he missed his shows because he ran away to South America for treatment!!!. I suggest search the web and you'll see the full story. |
David Brown <david.brown@hesbynett.no>: Jul 30 04:24PM +0200 On 30/07/17 02:26, Real Troll wrote: > had some mental problem and he missed his shows because he ran away to > South America for treatment!!!. I suggest search the web and you'll see > the full story. This is not really the place for such a topic, so I am not going to go into details or a long discussion. But here are a few key points: 1. People who are oppressed, bullied, ostracised, and pushed by their society, family, culture, or religion into trying to live and act in a way contrary to their nature are much more likely to suffer psychological problems than those who fit in with their peers. Thus if there is a higher proportion of psychological problems amongst homosexuals, it is due (at least primarily) to homophobic people and societies around them - not the homosexuality. 2. Even with their higher rates of psychological problems than heterosexuals, the rates of serious problems are far too low to say "homos generally have mental problems". 3. People who are willing to be open about one unusual aspect about their personality are more likely to be willing to be open about other unusual aspects. The opposite also applies. Thus amongst the people with psychological issues, people who are open about being homosexual are more likely to be open about their psychological problems. This will skew simple statistics. 4. Stephen Fry is extremely intelligent, and a professional comedian. These are both characteristics with a strong correlation with increased risk of psychological problems - completely independently of his sexuality. Now, I know you made these comments just to provoke a response - you are, after all, the /Real Troll/. But I don't like seeing such bigotry passing without correction. |
woodbrian77@gmail.com: Jul 30 07:59AM -0700 On Friday, July 28, 2017 at 5:34:48 PM UTC-5, Mr Flibble wrote: Leigh, please don't swear here. Tia. Brian Ebenezer Enterprises - Be joyful, patient and faithful. http://webEbenezer.net |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 30 04:59PM +0100 On 30/07/2017 15:24, David Brown wrote: > Now, I know you made these comments just to provoke a response - you > are, after all, the /Real Troll/. But I don't like seeing such bigotry > passing without correction. +1 /Flibble |
Real Troll <Real.Troll@Trolls.com>: Jul 30 04:10PM -0400 > On Friday, July 28, 2017 at 5:34:48 PM UTC-5, Mr Flibble wrote: > Leigh, please don't swear here. Tia. Please note he is gay and with serious mental problems. According to David Brown, he became mentally disturbed because he was bullied for being gay. Please read the entire thread to see what has happened to him. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 30 09:37PM +0100 On 30/07/2017 21:10, Real Troll wrote: > Please note he is gay and with serious mental problems. According to > David Brown, he became mentally disturbed because he was bullied for > being gay. Please read the entire thread to see what has happened to him. As trolls go that is quite a good one. /Flibble |
David Brown <david.brown@hesbynett.no>: Jul 30 11:33PM +0200 On 30/07/17 22:37, Mr Flibble wrote: >> being gay. Please read the entire thread to see what has happened to >> him. > As trolls go that is quite a good one. Yes - it was quite a neat and concise misreading and misrepresentation of what I wrote. I hope Brian does not believe it - he dislikes you enough as it is, without provoking his homophobia! |
woodbrian77@gmail.com: Jul 30 10:32AM -0700 On Friday, July 28, 2017 at 5:35:46 PM UTC-5, Richard wrote: > blog post. The flags enum example was particularly useful. He also > shows how it cleans up a whole bunch of crufty things like having to use > IDL compilers or the Qt moc compiler, making them entirely unnecessary Anyone who thinks on-line code generation is not here to stay needs counseling. > them through the language working group in the standards body. > One advantage of the approach advocated by Herb Sutter is that if you > don't like these metaclasses, you're not paying for them in any way. I think other alternatives capture the essence of C++ better, but it will be interesting to see how it unfolds. Brian Ebenezer Enterprises - In G-d we trust. http://webEbenezer.net |
jt@toerring.de (Jens Thoms Toerring): Jul 30 10:57AM > void operator=(T value) { *address = value; } > }; > } I've played around with this bit but get a problem when I try to do e.g, ReadWriteRegister<uint16_t, 0x1000> rwr; The compiler complains that it can't convert the integer constant to 'volatile T *const'. One way around may be to use 'intptr_t' in the second template parameter and then do the appropriate casts on it where needed. Another thing is that the address may not always a compile time constant, it might be e.g. obtained via a function call and thus unsuitable as a template parameter. Here's my take on this, trying to support both cases: template<typename T> class RegisterBase { protected: RegisterBase(T * address) : m_address(address) {} T read() const { return *m_address; } T write(T value) { return *m_address = value; } private: volatile T * m_address; }; template<typename T> struct ReadOnlyRegister : public RegisterBase<T> { ReadOnlyRegister(intptr_t address) : RegisterBase<T>(reinterpret_cast<T *>(address)) {} ReadOnlyRegister(void const * address) : RegisterBase<T>(const_cast<T *>(reinterpret_cast<T const *>(address))) {} operator T () const { return this->read(); } T operator = (T) = delete; }; template<typename T> struct WriteOnlyRegister : public RegisterBase<T> { WriteOnlyRegister(intptr_t address) : RegisterBase<T>(reinterpret_cast<T *>(address)) {} WriteOnlyRegister(void * address) : RegisterBase<T>(reinterpret_cast<T *>(address)) {} operator T () const = delete; T operator = (T value) { return this->write(value); } }; template<typename T> struct ReadWriteRegister : RegisterBase<T> { ReadWriteRegister(intptr_t address) : RegisterBase<T>(reinterpret_cast<T *>(address)) {} ReadWriteRegister(void * address) : RegisterBase<T>(reinterpret_cast<T *>(address)) {} operator T () const { return this->read(); } T operator = (T value) { return this->write(value); } }; I.e. the address is not a template parameter but is passed to the constructor. You thus should be able to use it like this #defined STAT_FLAGS_ADDR 0x10ea ReadOnlyRegister<uint16_t> state_flags(STATE_FLAGS_ADDR) as well as extern unsigned char * reg_base(void); #define STATE_FLAGS_OFFSET 0xea ReadOnlyRegister<uint16_t> state_flags(reg_base() + STATE_FLAGS_OFFSET); Another possibly interesting addition might be to be able to set other than the default methods for reading and writing. On some systems I've worked with certain registers where "protected" in that you couldn't write directly to them but this required that you first wrote certain values to some other register with a certain timing, before a write to the "real" register had an effect (to protect some important set- tings fron getting overwritten inadvertently). > I'm interested to hear if anyone else has done something similar > and how you approached the problem. Sorry, got no chance to use C++ in embedded programming yet, it always had to be C... Best regards, Jens -- \ Jens Thoms Toerring ___ jt@toerring.de \__________________________ http://toerring.de |
David Brown <david.brown@hesbynett.no>: Jul 30 01:29AM +0200 On 30/07/17 00:26, Rick C. Hodgin wrote: > If not, I propose new unary operators: > ?<< for BSF, as it scans up to find the first 1 bit > >>? for BSR, as it scans down to find the first 1 bit Why not just have functions to do the job? An operator does not give you any advantages here - it's just some cryptic symbols instead of a nice named function. If you want to propose that there should be functions like "ffs", "clz", "ctz" (find first zero, count leading zeros, count trailing zeros) in the standard library, then that would be fair enough. A common implementation could be done in straight C, and an implementation could use optimal implementations with bsf and bsr instructions on an x86 target. (Most processors have something similar - see the Wikipedia page for examples.) In the meantime, many compilers have extensions or built-ins that implement these functions. <https://en.wikipedia.org/wiki/Find_first_set> If your compile supports a better inline assembly syntax, you can use that to define the function. In gcc, you could use this as the equivalent to your "lowest_bit" function: static inline __attribute__((const, always_inline)) int bsf(unsigned int x) { unsigned int b; asm("bsf %[b], %[x]" : [b] "=r" (b) : [x] "r" (x)); return b; } Some might say it is a little ugly and hard to comprehend (and few would deny that), but it's the kind of thing you write once then hide away in a header somewhere rather than in application code. And it lets you use "bsf" optimally - no extra mov, ret, call, etc. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment