Go to advanced search

by sal55
Tue Dec 03, 2019 8:20 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

Don't you need "int main( void )" to be correct? Yes. There are 2-3 possible prototypes for 'main', and 'int main()' isn't one of them. The return value needs to be 'int' because the program is expected to return a status code. Although a compiler will warn if you pile on enough options, a beginner...
by sal55
Wed Nov 27, 2019 7:56 pm
Forum: C/C++
Topic: [solved] access dynamic multidimensional arrays like static arrays
Replies: 24
Views: 791

Re: access dynamic multidimensional arrays like static arrays

thank you for your contribution, but my question is already solved. By the proposals above, I can use static arrays in the stack just in the same way like dynamic arrays on the heap. OK, but other people may be reading the thread who have similar requirements, who don't know what VLAs can do. Howev...
by sal55
Tue Nov 26, 2019 7:32 pm
Forum: C/C++
Topic: [solved] access dynamic multidimensional arrays like static arrays
Replies: 24
Views: 791

Re: access dynamic multidimensional arrays like static arrays

Hi, How can I access dynamic multidimensional arrays like static arrays? (C-code, but actually compiled with cpp ) For example: I have a static array double arraystat [20] [10] and need another equally structured dynamic one double arraydyn [20] [10] I could allocate memory via double * mem = (doub...
by sal55
Mon Nov 25, 2019 2:50 pm
Forum: C/C++
Topic: Compiling gcc Options
Replies: 36
Views: 9058

Re: Compiling gcc Options

As I said the need for a cross compiler becomes handy when you are writing a large amount of code and want to compile it quickly. The raspberry pi is slow to compile. Maybe - if you are still thinking of the Pi Zero. The Pi4 4GB is fine. Aprox 50 million lines of code compiled in 3.5 hours. Its not...
by sal55
Fri Oct 18, 2019 6:51 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

:) Challenge! without looking it up, whats the conversion specifier for size_t ? :) Hey, I know that one! It's "%zu". On Linux. But it doesn't work on Windows, even with gcc (without messing around with libraries). It might be %lu, or %llu, depending on whether compiling 32 or 64 bits. So already 3...
by sal55
Fri Oct 18, 2019 5:09 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

It's C not GWBasic, types are a feature of the language not a problem and if you don't know what type T is then you really shouldn't be programming in C :-) People aren't being touchy about C ... your argument is stupid. You're goading me into a reply now. You may not know what T is because it's no...
by sal55
Fri Oct 18, 2019 5:00 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

If you want a better different, "better", language then create one. Better tackle all these UB's first else you are building you house on sand. At that point you have a very different language no longer backward compatible with C source. Javascript, Java, C#, Rust etc. I've done several, all used a...
by sal55
Fri Oct 18, 2019 4:48 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

It seems people are very touchy about their C language. It seems also that they don't understand what the problems are with 'printf', despite the examples I posted earlier. For example, what format code goes here: T a; printf("%...", a); In any modern language you just say 'print a'. In my modified ...
by sal55
Fri Oct 18, 2019 4:27 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

(Content deleted)
by sal55
Fri Oct 18, 2019 2:47 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

PeterO wrote:↑ 18 Oct 2019 13:00 I'm at a loss to understand what is stopping you from writing your own functions ? You can't write functions that work better than printf, because it needs language support. For example, consider a function that is called as: Code: Select all print(a, b, c); which p...
by sal55
Fri Oct 18, 2019 11:52 am
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

(Content deleted)
by sal55
Fri Oct 18, 2019 11:42 am
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

Re: C's 'printf'

(Content deleted)
by sal55
Fri Oct 18, 2019 9:40 am
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 2147

C's 'printf'

(Content deleted)
by sal55
Thu Oct 17, 2019 12:41 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

(Edited to remove off-topic stuff) Why do you insist on bashing on GCC for rather dubious reasons? GCC is a very fine C/C++ compiler. Sure. It can produce some of the best code. It's available everywhere. It can do a million things. But it's such a cumbersome product, the output can be so overwhelmi...
by sal55
Thu Oct 17, 2019 10:51 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

Is there any way to turn off all that ASCII art? It's filling my screen and causing the error messages to scroll off the top. Not the same, but you can reduce the amount of error message output from gcc: $ g++ -Werror -Wfatal-errors try.cpp Yes, gcc takes the Build-Your-Own-Compiler approach by hav...
by sal55
Wed Oct 16, 2019 7:08 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

At the end of the day, it's not the depth of C++ that scares me. If you see a feature you don't understand in some source you can generally find out. What scares me is it's failure modes, often silent, unpredictable, deadly. Hard to find and rectify therefore expensive. It is all the massive comple...
by sal55
Mon Oct 14, 2019 3:24 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

what do you mean by "such a small device"? Arduino supports really small AVRs with 16MHz/2.5 kB RAM, but also really big ones (ARM Cortex-M4 with Floating Point Unit, or ESP32) up to 180MHz/1M Flash/256K RAM and perhaps more (feat. stdio.h, RTOS, std::thread 8) ), and anything in between. Of course...
by sal55
Mon Oct 14, 2019 1:50 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

Arduino IS NOT C++, it USES C++, providing a high level-API for a convenient way to use different MCUs (AVR, SAM, SAMD, ESP) also by non-professional pogrammers (by help of Go and java IDE "processings"): https://arduinohistory.github.io/ http://people.interactionivrea.org/h.barragan/thesis/thesis_...
by sal55
Mon Oct 14, 2019 10:30 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

plugwash, Expected by who though? that is the question. I was thinking of these people: WG21 (ISO C++ Committee): https://isocpp.org/wiki/faq/wg21 The people, starting with Bjarne Stroustrup who have invested a large part of their lives into creating C++. When Stroustrup added classes to C he obvio...
by sal55
Sun Oct 13, 2019 9:53 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

sal55, C, yes, as it underpins everything else practically. I used to think so too. Turns out that might not be true. Pretty much all the computing I do rests on the GCC or LLVM compilers. LLVM is written in C++. A lot of GCC is written in C++ and as of 2012 a C++ compiler has been required to buil...
by sal55
Sat Oct 12, 2019 10:56 pm
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6052

Re: Where can I begin learning C/C++?

Any particular reason why you want to go with C++?

C, yes, as it underpins everything else practically. But C++ is a monster of a language, especially if beginning programming, and one of the most complex languages ever.
by sal55
Tue Oct 08, 2019 11:46 am
Forum: General discussion
Topic: RPI4: Why is everything still 32-bit?
Replies: 186
Views: 9415

Re: RPI4: Why is everything still 32-bit?

It's been well publicised for some years that Raspbian is 32bit. This is for a number of reason - firstly backwards compatibility with previous models and the Pi0. We only need one distro and it runs on all devices. I didn't know this literally meant one binary distribution that could work on any P...
by sal55
Fri Oct 04, 2019 9:21 pm
Forum: Other programming languages
Topic: The Rust debate.
Replies: 151
Views: 10484

Re: The Rust debate.

Honeywell mainframe by any chance? I used B on one of those (yes 36 bit "words" only). C promotes smaller types to "int" before arithmetic. Int is whatever size is naturally best for the machine. I presume the original development PDP had type int as 16 bits, nowadays its normally 32-bits. No, it w...
by sal55
Fri Oct 04, 2019 12:13 pm
Forum: Other programming languages
Topic: The Rust debate.
Replies: 151
Views: 10484

Re: The Rust debate.

Actually, I'm not even sure the ARM architecture directly supports arithmetic operations on values of arbitrary width (I think operands can be loaded or stored at any width). Yes. ARM can only do arithmetic on full 32-bit registers or in 64-bit mode, 64-bit registers also. You can load and store 8,...
by sal55
Fri Oct 04, 2019 12:41 am
Forum: Other programming languages
Topic: The Rust debate.
Replies: 151
Views: 10484

Re: The Rust debate.

jcyr, The nanny language... I'd rather take responsibility for my bad code I'm not sure how much you are joking there but that is a position expressed by many programmers. As seen in this thread and elsewhere. I get the feeling it especially comes from "old hands" who have spend years mastering the...

Go to advanced search