Click here to Skip to main content
16,005,037 members

The Insider News

   

The Insider News is for breaking IT and Software development news. Post your news, your alerts and your inside scoops. This is an IT news-only forum - all off-topic, non-news posts will be removed. If you wish to ask a programming question please post it here.

Get The Daily Insider direct to your mailbox every day. Subscribe now!

 
GeneralRe: New algorithm discovers language just by watching videos Pin
Richard Deeming12-Jun-24 21:46
mveRichard Deeming12-Jun-24 21:46 
GeneralRe: New algorithm discovers language just by watching videos Pin
Kent Sharkey13-Jun-24 3:54
staffKent Sharkey13-Jun-24 3:54 
NewsPayoff from AI projects is 'dismal', biz leaders complain Pin
Kent Sharkey12-Jun-24 7:16
staffKent Sharkey12-Jun-24 7:16 
GeneralRe: Payoff from AI projects is 'dismal', biz leaders complain Pin
Rick York12-Jun-24 10:30
mveRick York12-Jun-24 10:30 
GeneralRe: Payoff from AI projects is 'dismal', biz leaders complain Pin
jeron112-Jun-24 11:27
jeron112-Jun-24 11:27 
NewsMicrosoft deprecates Windows DirectAccess, recommends Always On VPN Pin
Kent Sharkey12-Jun-24 7:01
staffKent Sharkey12-Jun-24 7:01 
NewsSwift the best choice to succeed C++, Apple says Pin
Kent Sharkey12-Jun-24 6:24
staffKent Sharkey12-Jun-24 6:24 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
Shao Voon Wong12-Jun-24 14:51
mvaShao Voon Wong12-Jun-24 14:51 
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 10
C++
for(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.
Swift
for number in 0...10 
{
    print(number)
}

This is a C for loop to increment from 0 to 9
C++
for(int i=0; i<10; ++i)
{
    printf("%d", i);
}

This is Swift version of the same thing.
Swift
for number in 0..<10 
{
    print(number)
}

This is the C for-loop that increment from 0 to 256 in steps of 16
C++
for(int i=0; i<=256; i+=16)
{
    printf("%d", i);
}

This is Swift version
Swift
for number in stride(from: 0, through: 256, by:16) 
{
    print(number)
}

This is C for-loop of decrementing by steps of 16.
C++
for(int i=256; i>=0; i-=16)
{
    printf("%d", i);
}

This is Swift version of decrementing by steps of 16.
Swift
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
C++
do
{
    ...
}
while (i<10);

Swift version of do-while
Swift
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.

modified 12-Jun-24 23:22pm.

GeneralRe: Swift the best choice to succeed C++, Apple says Pin
honey the codewitch13-Jun-24 4:15
mvahoney the codewitch13-Jun-24 4:15 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
charlieg14-Jun-24 4:41
charlieg14-Jun-24 4:41 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
honey the codewitch14-Jun-24 4:43
mvahoney the codewitch14-Jun-24 4:43 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
charlieg14-Jun-24 4:47
charlieg14-Jun-24 4:47 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
honey the codewitch14-Jun-24 4:48
mvahoney the codewitch14-Jun-24 4:48 
GeneralRe: Swift the best choice to succeed C++, Apple says Pin
charlieg14-Jun-24 4:49
charlieg14-Jun-24 4:49 
NewsVisual Studio 2022 – 17.10 performance enhancements Pin
Kent Sharkey12-Jun-24 6:21
staffKent Sharkey12-Jun-24 6:21 
GeneralRe: Visual Studio 2022 – 17.10 performance enhancements Pin
den2k8813-Jun-24 3:34
professionalden2k8813-Jun-24 3:34 
NewsEverything you need to know about Finch, the latest programming language developed by MIT Pin
Kent Sharkey11-Jun-24 8:16
staffKent Sharkey11-Jun-24 8:16 
GeneralRe: Everything you need to know about Finch, the latest programming language developed by MIT Pin
MarkTJohnson11-Jun-24 10:10
professionalMarkTJohnson11-Jun-24 10:10 
NewsDARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
Kent Sharkey11-Jun-24 7:46
staffKent Sharkey11-Jun-24 7:46 
GeneralRe: DARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
MarkTJohnson11-Jun-24 10:19
professionalMarkTJohnson11-Jun-24 10:19 
GeneralRe: DARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
Kent Sharkey11-Jun-24 10:50
staffKent Sharkey11-Jun-24 10:50 
GeneralRe: DARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
MarkTJohnson12-Jun-24 4:12
professionalMarkTJohnson12-Jun-24 4:12 
GeneralRe: DARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
Daniel Pfeffer12-Jun-24 10:30
professionalDaniel Pfeffer12-Jun-24 10:30 
GeneralRe: DARPA’s planned nuclear rocket would use enough fuel to build a bomb Pin
Bernhard Hiller12-Jun-24 3:17
Bernhard Hiller12-Jun-24 3:17 
NewsSupercapacitors are about to blow past batteries as the kings of power Pin
Kent Sharkey11-Jun-24 7:31
staffKent Sharkey11-Jun-24 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.