|
In most languages, at least in my experience, the things that you can and can't do with it are pretty clear.
With C++, this isn't really the case. Because of things like metaprogramming, and the sheer flexibility of it, it's often not a case of whether or not you can do a thing, but rather how you can coax, tease, finagle, or otherwise cajole the compiler into doing what you're asking of it.
And therein lies the rub. I sometimes find myself running into things that I know *should* be solvable in C++, but how to do it requires (often) days of banging on a narrow section of code to get it to do what I need.
I love the mental challenge of it, but I hate the frustration that often comes with that. Sometimes I don't want a challenge - I just want the thing to work. And even when it does the code is often write only code.
To err is human. Fortune favors the monsters.
|
|
|
|
|
I find the same frustration level in WPF.
The learning curve is so steep, the language so flexible and powerful that I fight problems for hours or sometimes days at a time to straighten things out.
Like you sometimes I just want it to work.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
I've reached that level with WPF. I'll be going along just swimmingly, and all of a sudden the easiest thing just. doesn't. work. I have the most trouble with bindings, largely because the XAML syntax is brutal.
Software Zen: delete this;
|
|
|
|
|
Bindings are very powerful but they can really be a PITA. Chasing a bad binding is akin to a bad pointer.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
I lay blame for that on the academics who've had control of the language design for so long. There are any number of features that would be useful in the language, but they have this abhorence of limiting conditions of application that it's impossible to add new things. And don't get me started on the run-time library.
It may be silly season at times in C# land, but at least we get useful stuff now and then.
Software Zen: delete this;
|
|
|
|
|
I will give C++ this though - I can do things at compile time with it that can't be done in any other language that I'm aware of. The trick is knowing how to do it.
To err is human. Fortune favors the monsters.
|
|
|
|
|
+1
It makes it so easy to do things at compile time.
|
|
|
|
|
It depends on what you're doing!
I have a graphics library that lets you define arbitrary pixel formats and color models using templates.
It can then render to bitmapped memory in the given memory layout, doing the appropriate bit shifts and masking and such to pack each individual color channel into the pixel value.
gfx_demo/gfx_pixel.hpp at master · codewitch-honey-crisis/gfx_demo · GitHub[^]
It also lets you convert to different pixel formats at compile time, and can do alpha blending at compile time.
This was not easy to do at compile time.
To err is human. Fortune favors the monsters.
|
|
|
|
|
Greetings Kind Regards Can you provide an example of the "narrow code"? Perhaps an article would be useful to this paltry programmer. - Best Cheerio
|
|
|
|
|
By narrow, I just meant code that performs a particular task or something.
Like making this return the nearest integer type that can contain data of the specified bit depth:
bits::uintx<bits::get_word_size(BitDepth)>
Or a more complicated example, shifting an arbitrary number of bits an arbitrary number of digits left at compile time:
nstexpr static void shift_left(void* bits,size_t offset_bits,size_t size_bits, size_t shift) {
if(nullptr==bits || 0==size_bits || 0==shift) {
return;
}
if(shift>=size_bits) {
set_bits(bits,offset_bits,size_bits,false);
return;
}
uint8_t* pbegin = ((uint8_t*)bits)+(offset_bits/8);
const size_t offset = offset_bits % 8;
const size_t shift_bytes = shift / 8;
const size_t shift_bits = shift % 8;
const size_t overhang = (size_bits+offset_bits) % 8;
const uint8_t left_mask = ((uint8_t)uint8_t(0xFF<<(8-offset)));
const uint8_t right_mask = 0!=overhang?uint8_t(0xFF>>overhang):0;
uint8_t* pend = pbegin+(size_t)((offset_bits+size_bits+7)/8);
uint8_t* plast = pend-1;
uint8_t* psrc = pbegin+shift_bytes;
uint8_t* pdst = pbegin;
if(pbegin+1==pend) {
uint8_t save_mask = left_mask|right_mask;
uint8_t tmp = *pbegin;
*pbegin = uint8_t(uint8_t(tmp<<shift_bits)&~save_mask)|
uint8_t(tmp&save_mask);
return;
}
uint8_t left = *pbegin;
uint8_t right = *(pend-1);
while(pdst!=pend) {
uint8_t src = psrc<pend?*psrc:0;
uint8_t src2 = (psrc+1)<pend?*(psrc+1):0;
*pdst = (src<<shift_bits)|(src2>>(8-shift_bits));
++psrc;
++pdst;
}
*pbegin=(left&left_mask)|uint8_t(*pbegin&~left_mask);
--pend;
*plast=uint8_t(right&right_mask)|uint8_t(*plast&uint8_t(~right_mask));
};
To err is human. Fortune favors the monsters.
|
|
|
|
|
Some time back I bought a desktop CNC router[^] and today I routed my first project. Nothing exciting just cut out a block with a depression in the middle.
I bought it with the intention of etching PCBs...that's next.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Keep us posted.
What is your target trace width? Will you do SMT or only through hole?
Mircea
|
|
|
|
|
I recently got a Hot Air station and am now doing SM as well as thro7ugh hole. Trace width right now are pretty wide.5 if I remember right. But the PCB I'm doing is drop dead simple.
Also in the process of making a bigger more powerful one that I can do other more substantial materials. The whole process has really been a neat experience and am excited with the possibilities.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Mike Hankey wrote: just cut out a block with a depression in the middle. Sounds like your typical IT project.
Step 1: Start project.
Step 2: Become depressed (not in the least caused by incompetent managers and coworkers).
Step 3: Finish project (over time and budget, naturally).
Although step 3 should be considered an optional bonus step that not all teams like to take
|
|
|
|
|
Sander Rossel wrote: step 3 should be considered an optional bonus step My last company had that down to a fine art form.
|
|
|
|
|
Mike Hankey wrote: I bought it with the intention of etching PCBs...that's next.
Will you be grinding away the unwanted copper, or using a resist pen to draw the actual traces and then chemically etching the boards?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I use V bits[^] to etch the copper from PCB.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Mike Hankey wrote: Nothing exciting just cut out a bloke with a depression in the middle.
I didn't know you too were in the goth community
GCS d--(d-) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I'm stuffed in the bedroom, and I work from this machine, so I've got a workspace that's combination electronics bench, computer desk and entertainment center.
I thought I was slick, making it all multifunction like that, but I can't keep it even remotely organized.
I bought a tacklebox-like setup for the electronics I'm not actively using but I think I just need more space. Shelves aren't really an option because of the size of the screen + where I'm located.
I have a rolling cart - the kind of thing you might have set a couple of TV dinners on in the 1970s when those were still a thing, but it's actually nice looking.
I might use that to set my PC and other gear on but I don't know if it's enough.
Have any of you out there with particularly cramped computer areas come up with clever solutions you're proud of?
If so, I wouldn't mind if you shared them here. I wouldn't mind very much.
To err is human. Fortune favors the monsters.
|
|
|
|
|
When I was volunteering at State Parks I lived in a camper with computer and all my electronics stuff, and it is a considerable collection. I put a board across the eating table and built shelves underneath it and stored all my electronics stuff there. It was a small camper but I managed, wish I had a picture.
I have a small room now and a lot more equipment so I build bookcases and took the doors off the closet and use it for storage.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Same.
Using large boards on cheap block-shelves, drawers, or similar furniture is the best way I've found to quickly create large desktops.
|
|
|
|
|
My first programming job, back in the dark ages, was a door blank on a pair of saw horses. Plenty of room and cheap!
The cleaning lady came in late one day and was in a chit-chatty mood, she picked up a 5-1/4" disk off my table and was going to clean it.
The less you need, the more you have.
Even a blind squirrel gets a nut...occasionally.
JaxCoder.com
|
|
|
|
|
Quote: I've got a workspace that's combination electronics bench, computer desk and entertainment center. Not also bed? That would fit in with the first part of your post, which is NSFW.
|
|
|
|
|
One can also source a convertible bed/desk thingy.
|
|
|
|
|