Swift the best choice to succeed C++, Apple says
-
Swift tries too hard to be different from C/C++ to stand out. For example,
++
and--
operators do not exist in Swift through+=
and-=
exists. Its for-loop are different and inflexible. This is a C for loop to increment from 0 to 10for(int i=0; i<=10; ++i)
{
printf("%d", i);
}This is Swift version of the same thing. It has limitations that it cannot increment more than one in a single step or decrement.
for number in 0...10
{
print(number)
}This is a C for loop to increment from 0 to 9
for(int i=0; i<10; ++i)
{
printf("%d", i);
}This is Swift version of the same thing.
for number in 0..<10
{
print(number)
}This is the C for-loop that increment from 0 to 256 in steps of 16
for(int i=0; i<=256; i+=16)
{
printf("%d", i);
}This is Swift version
for number in stride(from: 0, through: 256, by:16)
{
print(number)
}This is C for-loop of decrementing by steps of 16.
for(int i=256; i>=0; i-=16)
{
printf("%d", i);
}This is Swift version of decrementing by steps of 16.
for number in stride(from: 256, to: 0, by: -16)
{
print(number)
}C for-loop syntax more or less stay the same while Swift's change depending whether you want to increment more than one or decrement. C version of do-while
do
{
...
}
while (i<10);Swift version of do-while
repeat
{
...
}
while (i<10);These are some examples. The try-catch exception is also very different. I tried to port my Windows DirectX application to Apple Metal but I gave up because the Swift's syntax is too different. I do not mean they should be the same. At least, the basic syntax should stay the same instead to be different in order to differentiate Swift from other C-compatible languages. So that I only struggle on the DirectX/Metal differences rather than the language's unimportant differences.
-
Yeah, no. C++ isn't going anywhere. Not in my lifetime. Not in yours. If I had kids, not in theirs. The fact that languages like Rust and Swift are touted by their authors as C++ successors just reinforces the idea that C++ is the language to "beat". (Such as that means anything in this context) C++ is flexible, powerful, and entrenched. The fact that it has been around for decades means sheer inertia will keep it moving for many more.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Yeah, no. C++ isn't going anywhere. Not in my lifetime. Not in yours. If I had kids, not in theirs. The fact that languages like Rust and Swift are touted by their authors as C++ successors just reinforces the idea that C++ is the language to "beat". (Such as that means anything in this context) C++ is flexible, powerful, and entrenched. The fact that it has been around for decades means sheer inertia will keep it moving for many more.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
C++ has enough issues with complexity as it is.... but one thing that irritates me to no end are developers who say they know C++, but when you look at their code, it's just C. Yeah, I know C++ is just a better C compiler (was told this one time), but in the world I live in, most cannot spell "class".
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
C++ has enough issues with complexity as it is.... but one thing that irritates me to no end are developers who say they know C++, but when you look at their code, it's just C. Yeah, I know C++ is just a better C compiler (was told this one time), but in the world I live in, most cannot spell "class".
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
charlieg wrote:
but one thing that irritates me to no end are developers who say they know C++, but when you look at their code, it's just C
I'm half guilty of that because I do embedded, which often requires me to forgo the STL for want of a compliant version, if it exists at all. And even if it does, it's not set up for multiple heaps, nor using tiny heaps responsibly. While I could make custom allocators for everything, it's often just easier to use the C functions for what I need. I still make judicious use of class, struct, and template.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
charlieg wrote:
but one thing that irritates me to no end are developers who say they know C++, but when you look at their code, it's just C
I'm half guilty of that because I do embedded, which often requires me to forgo the STL for want of a compliant version, if it exists at all. And even if it does, it's not set up for multiple heaps, nor using tiny heaps responsibly. While I could make custom allocators for everything, it's often just easier to use the C functions for what I need. I still make judicious use of class, struct, and template.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
This is where I live as well, so it explains a lot. But in the herd of engineers I work with, I'll come across a mishmash of coding styles. In 20 years, the group has never been able to standardize on coding standards let alone development philosophy. And, as you say, one must be very careful using C++ features in an embedded RTOS environment. If those support libraries aren't coded correctly, you'll lose too much performance. Ah well, on 6/27, you'll find me by the pool.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
This is where I live as well, so it explains a lot. But in the herd of engineers I work with, I'll come across a mishmash of coding styles. In 20 years, the group has never been able to standardize on coding standards let alone development philosophy. And, as you say, one must be very careful using C++ features in an embedded RTOS environment. If those support libraries aren't coded correctly, you'll lose too much performance. Ah well, on 6/27, you'll find me by the pool.
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
charlieg wrote:
Ah well, on 6/27, you'll find me by the pool.
Vacay or retirement?
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
charlieg wrote:
Ah well, on 6/27, you'll find me by the pool.
Vacay or retirement?
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix