|
2 for me too!
Wordle 932 2/6*
β¬β¬π©π¨β¬
π©π©π©π©π©
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
β¬β¬β¬π©β¬
β¬β¬π©β¬π¨
π©π©π©π©π©
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 932 4/6
β¬β¬β¬β¬π¨
π¨π©β¬β¬β¬
π©π©π©β¬β¬
π©π©π©π©π©
βThat which can be asserted without evidence, can be dismissed without evidence.β
β Christopher Hitchens
|
|
|
|
|
Wordle 932 3/6
β¬β¬π©π©β¬
β¬β¬π©π©β¬
π©π©π©π©π©
Ok, I have had my coffee, so you can all come out now!
|
|
|
|
|
|
I have a legacy software to draw very sophisticated charts.
but I only need a small piece of these charts.
I want to re-write the code charting this small piece of charts.
How hard it is to do this? any experience to share?
diligent hands rule....
modified 6-Jan-24 15:49pm.
|
|
|
|
|
MFC to WPF or what? I did some conversions from C++ to C# for a complex math problem. That was pretty straight-forward since the finished C# code was not that different from C++ once you got into it.
|
|
|
|
|
WinForm in my mind.
diligent hands rule....
|
|
|
|
|
It varies widely depending on the project.
For user interface stuff (at least assuming windows) if you were using like, MFC before, you're basically going to need to rewrite that part using the original code as a reference.
For algorithmic stuff it depends. If you're doing pointer ops all over the place that will be difficult to port as you need to change it to indexing into arrays (typically). Otherwise, if you're using things like vector and map they have direct corollaries in C# so that kind of thing is easier.
Just remember structs are on the stack and classes are on the heap in C#. That has a lot of different ramifications, such as changing how they are passed to functions (byval instead of byref). Be careful when porting that kind of thing from C++ which makes little distinction between classes and structs.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Out of curiosity, is an enum a class or struct?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
In C and C++ it doesn't really matter. In fact it's compiled into constant nothings basically (removed).
In C# it's a ValueType which makes it closer to a struct than a class in terms of how it behaves - stack vs heap, etc.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
diligent hands rule....
|
|
|
|
|
|
|
It's easy. Start a new project in the target language of your choice. Copy the bare minimum from the source language, paste it in the new language target husk, and attempt to compile.
You'll get tons of errors and warnings. Pick through them and eliminate them one-by-one.
Obviously there's a lot of personal experience in "attempting" to do anything using a compiler and a linker.
Done this, have I. Learned much have I.
modified 8-Jan-24 14:55pm.
|
|
|
|
|
RedDk wrote: You'll get tons of errors and warnings. Pick through them an eliminate them one-by-one. It's hard to tell if that's sage advice or sarcasm.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
It sounds like the advice to start with a block of stone and remove the parts which don't look like an elephant.
|
|
|
|
|
This is exactly how I converted about 10,000 lines of VB6 code to VB 2005. The biggest changes were file handling and error reporting. To this day I'll occasionally use On Error Resume Next in short Subs and Functions when it's appropriate. Otherwise I use Try/Catch/Finally.
|
|
|
|
|
That's it exactly. Initially posting line-numbered QBASIC code into a C++ project ... I was surprised how little squawking the VS interface returned. I like that "On Error Resume" trick. Next time ...
|
|
|
|
|
obermd wrote: To this day I'll occasionally use On Error Resume Next as long as you put something in between...
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
On Error Resume Next is really useful for short clean up routines where the code would look like this
try {statement1} catch {}
try {statement2} catch {}
...
|
|
|
|
|
what (empty catch blocks) actually is something I do not like, have already lost some precious time tracking down things done by people thinking it is not needed.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
At least to me the OP suggested that they want to use WinForms and that existing code does not use that.
So that is a complete rewrite at least for that part.
|
|
|
|
|
Does it 'need' to be C#? Or can you use C++/CLI? Because the latter would be much simpler, in the sense that you can keep your algorithms and the back end stuff in C++, and do the user interface in C++/CLI.
Is your user interface in MFC, or WTL or something else?
The user interface would have to be re-built from scratch
|
|
|
|
|
You're going to have to rewrite UI code regardless. The one advantage going to WinForms would be correspondence in the UI. WinForms is something of a wrapper around Windows GDI controls for C#, in the same sense that MFC is a wrapper for C++.
Software Zen: delete this;
|
|
|
|