English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 11 July 2017, 21:23   #401
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 2,801
Funny that the Atari guys seem to have been doing their own port of GCC 6.2 in isolation:
http://d-bug.mooo.com/beyondbrown/post/gcc-6/
idrougge is online now  
AdSense AdSense  
Old 11 July 2017, 21:29   #402
Marlon_
Apollo Supporter

Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Sundsvall, Sweden
Age: 28
Posts: 146
Send a message via Skype™ to Marlon_
Quote:
Originally Posted by idrougge View Post
Funny that the Atari guys seem to have been doing their own port of GCC 6.2 in isolation:
http://d-bug.mooo.com/beyondbrown/post/gcc-6/
Well, that's funny and also at the same time good news. Maybe the projects could be merged somehow for a joint effort towards a modern 68k compiler?
Marlon_ is offline  
Old 12 July 2017, 00:14   #403
alkis
Registered User

 
Join Date: Dec 2010
Location: Athens/Greece
Age: 46
Posts: 322
Lamdas work

Code:
#include<iostream>
#include<complex>

int main() {
  // Store a generalized lambda, that squares a number, in a variable
  auto func = [](auto input) { return input * input; };

  // Usage examples:
  // square of an int
  std::cout << func(10) << std::endl;

  // square of a double
  std::cout << func(2.345) << std::endl;

  // square of a complex number
  std::cout << func(std::complex<double>(3, -2)) << std::endl;

  return 0;
}
m68k-amigaos-g++ -noixemul -o lamda lamda.cpp

Code:
-rwxr-xr-x  1 alex alex  630976 Jul 12 00:58 lamda
-rwxr-xr-x  1 alex alex   14096 Jul 12 01:05 lamda_linux
Gives a 630k executable (linux' exe is at 14k)

and here is the output from amiga
Code:
New Shell process 3
3.Work:t> stack 100000
3.Work:t> lamda
100
5.49902
(5,-12)
3.Work:t>
x64 and rasberry pi both give 5.49903, amiga rounds down. (exact value 5.499025)

Never the less, HOW COOL IS THAT!
alkis is offline  
Old 12 July 2017, 09:45   #404
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 121
Quote:
Originally Posted by alkis View Post
Lamdas work

Code:
#include<iostream>
#include<complex>

int main() {
  // Store a generalized lambda, that squares a number, in a variable
  auto func = [](auto input) { return input * input; };

  // Usage examples:
  // square of an int
  std::cout << func(10) << std::endl;

  // square of a double
  std::cout << func(2.345) << std::endl;

  // square of a complex number
  std::cout << func(std::complex<double>(3, -2)) << std::endl;

  return 0;
}
m68k-amigaos-g++ -noixemul -o lamda lamda.cpp

Code:
-rwxr-xr-x  1 alex alex  630976 Jul 12 00:58 lamda
-rwxr-xr-x  1 alex alex   14096 Jul 12 01:05 lamda_linux
Gives a 630k executable (linux' exe is at 14k)

and here is the output from amiga
Code:
New Shell process 3
3.Work:t> stack 100000
3.Work:t> lamda
100
5.49902
(5,-12)
3.Work:t>
x64 and rasberry pi both give 5.49903, amiga rounds down. (exact value 5.499025)

Never the less, HOW COOL IS THAT!
Do not use iostream if you want small programs. Using printf reduces size to 11720 bytes.

Code:
#include<stdio.h>
#include<complex>

int main() {
  // Store a generalized lambda, that squares a number, in a variable
  auto func = [](auto input) { return input * input; };

  printf("%d\n", func(10));

  printf("%f\n", func(2.345));

  auto c = func(std::complex<double>(3, -2));
  printf("(%f, %f)\n", c.real(), c.imag());

  return 0;
}
bebbo is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 4 12 October 2016 22:28
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 03:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 21:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 14:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:47.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.11573 seconds with 14 queries