No argument from me on that score. My first assembly language was for a piece of BIG iron*.Many will disagree with me: If you are going to program microcontrollers, learn .asm first (for a MCU of your choice). You can always learn C later, but at least then you'll have an understanding of what goes on on the inside.
My first love was BASIC... and later I learned Pascal and COBOL (may they both RIP)... learning C was a pain in the you-know-what, but it taught me the importance of keeping things structured, orderly, and well-commented. Later on I became a LISP expert for AutoCAD, and finally... I learned ASM for the 8051 MCUs.... now I feel that maybe I should've learned that last one first...I don't think the order is important. As a matter of fact, I think ASM is easier to learn as a later language. My sequence was Fortran, LISP, Basic, Pascal, Algol, COBOL, ASM, Perl, Java, C. (To the best of my memory, which means no guarantees )
As I mentioned above, a good foundation in programming algorithms is important. Having that before programming in ASM made it easier.
Don't get me wrong! I believe ASM should be in every programmer's toolbox.
And I'm still looking for challenges!.... Truth being told... I haven't bothered to learn Java or Perl... yet. Maybe soon I'm going to find myself cornered into taking a dip in them.Programming Languages are kinda like Lay's potato chips. Betcha can't eat just one!
I'm loving my RPi 2 here. Most of my programming is in C at the kernel level where C is just a high level assembler for the Linux abstract machine.Hello,
Ok, I am not that familiar with the Arduino.
I just started with a Raspberry Pi 2 over here.
Bertus
The only problem to be multi-lingual is that it takes lots of time.I don't think there is a recommended language. IMHO you should learn every language that you can find information about. Haw can it hurt you to be multi-lingual?
I limit the use of C goto to this type of function, where failure is fatal and we need a bug-out shortcut to quickly run a simple sequence.BASIC doesn't have the loop structures (except for BASIC-based languages like FreeBASIC) to make eliminating Goto commands simple. The use of Boolean variables, properly constructed code blocks controlled by While or Switch statements and judicious use of the C Break statement will eliminate most Goto statements AND result in clearer code.
/* called for each listed spigert device in the bcm270*.c file */
static int spidev_spi_probe(struct spi_device *spi)
{
struct comedi_control *pdata;
int ret;
pdata = kzalloc(sizeof(struct comedi_control), GFP_KERNEL);
if (!pdata) return -ENOMEM;
... just dump out or do stuff ...
pdata->tx_buff = kzalloc(SPI_BUFF_SIZE, GFP_KERNEL | GFP_DMA);
if (!pdata->tx_buff) {
ret = -ENOMEM;
goto kfree_exit;
}
pdata->rx_buff = kzalloc(SPI_BUFF_SIZE, GFP_KERNEL | GFP_DMA);
if (!pdata->rx_buff) {
ret = -ENOMEM;
goto kfree_tx_exit;
}
... free alloc memory or do stuff ...
/* Check for basic errors */
ret = spi_w8r8(spi, 0); /* check for spi comm error */
if (ret < 0) {
dev_err(&spi->dev, "SPI not working\n");
ret = -EIO;
goto kfree_rx_exit;
}
if (!(spi->mode & SPI_NO_CS) &&
(spi->chip_select > spi->master->num_chipselect)) {
dev_err(&spi->dev,
"setup: invalid chipselect %u (%u defined)\n",
spi->chip_select, spi->master->num_chipselect);
ret = -EINVAL;
goto kfree_rx_exit;
}
return 0;
... free memory ...
kfree_rx_exit:
kfree(pdata->rx_buff);
kfree_tx_exit:
kfree(pdata->tx_buff);
kfree_exit:
kfree(pdata);
return ret;
}
by Aaron Carman
by Jake Hertz
by Duane Benson