|
From the "known issues" section of the NEW! XC8 compiler from Microshit: 1) For PIC18 devices and when the compiler is operating in PRO mode, assignment of an address to a pointer that is a member of a union which in tern is part of a structure may fail if the member is accessed via structure pointer a in the following example. Pointers are hard ok 2) If a function returns a pointer, the size of this pointer is larger than 1 byte, and also larger than the total size of all the parameters passed to this function, then the memory used by the return value may not be allocated. The function's return value may overwrite other local variables and lead to code failure. Consider adding a dummy parameter to the function with the same size as the return value type. Thanks for the sane workaround! 3) Structures which are auto cannot be initialized. I mean I guess I can see how they didn't catch this 4) If a constant is used as the index into an array of const int type, the element read may be incorrect. I don't even understand how that bug comes into being. 5) Variables which are absolute and which are not const cannot be initialized. The following example will not generate an error, but will not work as expected. Define the variable as absolute and initialize it in main-line code. unsigned int varname @ 0x0200=0x40; // will not work as expected ...and this is what led me to this list. 6) Arrays that qualified as eeprom and which are initialized may not have all initial values written to the EEPROM. They really hate initializing poo poo. Never initialize anything. Ever.
|
# ? Jun 7, 2013 18:08 |
|
|
# ? May 17, 2024 13:31 |
|
Writing C compilers for 8-bit processors has to be a colossal pain in the rear end.
|
# ? Jun 7, 2013 18:28 |
|
No Microchip is just the worst vendor ever.
|
# ? Jun 7, 2013 19:02 |
|
Letters from microchip support part 1: Hello [Ipsum], The MCU8 divisional applications engineer has sorted out the TO bit issue for you. They state that this relates to a project options setting in the Build Options/Linker/ fields. You will need to uncheck the Clear bss and Initialize data settings. Regards, P.K
|
# ? Jun 7, 2013 19:40 |
|
Objective-C code:
|
# ? Jun 7, 2013 22:04 |
|
Objective-C code:
Sinestro fucked around with this message at 11:18 on Jun 8, 2013 |
# ? Jun 8, 2013 10:59 |
|
b0lt posted:
How does that work, where does alloc/init get called? Is that implicit in Objective-C++? Or is it the fact that you're isa-swizzling that's obviating the need? Also, what is the point, it just seems like adding more code for no reason.
|
# ? Jun 8, 2013 12:17 |
|
It's getting allocated on the stack, so there's no need to alloc memory on the heap for it. Calling init would be needed if one were ever to subclass from it with an obj-C class, but the constructor is doing everything that [NSObject init] needs to do.
|
# ? Jun 8, 2013 14:36 |
|
Sinestro posted:I'm honestly not sure what the worst part of this is, the problem or the solution. If you encountered the same problem, what would you do?
|
# ? Jun 8, 2013 18:21 |
|
b0lt posted:
Can you (or someone who knows about ObjectiveC/C++ interop) explain the horror here as it looks reasonable to me but I am clueless about Objective C so...
|
# ? Jun 8, 2013 18:55 |
|
return0 posted:Can you (or someone who knows about ObjectiveC/C++ interop) explain the horror here as it looks reasonable to me but I am clueless about Objective C so... In objc everything is derived from objc_object, including class and interface definitions. objc_object has a member 'isa' which points to its class definition object, and a method 'class' that returns its isa. So he creates the interface aaagh, which you usually just specify when making a class, but then the class Test instead of implementing aaargh explicitly assigns its isa pointer to the class of the interface itself, which winds up valid since Test doesn't have any members. Net result is an interface instantiated as an object. I guess if you really needed pointers to interfaces for some reason it'd be useful, but otherwise it's just a weird abuse of the base objc inheritance. E: Missed that he defined 'id' too. [object id] in objc is a basic object method equivalent to { return (void*) this; } and I'm pretty sure it's not in objc_object, just NSObject (the base instantiated object class). This is basically The Thing : objc edition. bucketmouse fucked around with this message at 19:48 on Jun 8, 2013 |
# ? Jun 8, 2013 19:40 |
|
bucketmouse posted:which winds up valid since Test doesn't have any members. virtual functions, not members. Objective C objects are just structs with the first element being an isa pointer.
|
# ? Jun 8, 2013 19:59 |
|
b0lt posted:I am somewhat considering using this in production, help someone stop me the horror is coming from inside the house As pointed out by others, you want this: Objective-C code:
bucketmouse posted:E: Missed that he defined 'id' too. [object id] in objc is a basic object method equivalent to { return (void*) this; } and I'm pretty sure it's not in objc_object, just NSObject (the base instantiated object class). This is basically The Thing : objc edition. It's actually a conversion operator to the built-in Objective C type "id", which is like void * for Objective C objects hackbunny fucked around with this message at 20:30 on Jun 8, 2013 |
# ? Jun 8, 2013 20:17 |
|
Suspicious Dish posted:If you encountered the same problem, what would you do? That != should be ==. As written, that code ignores all errors that aren't Tidy warnings.
|
# ? Jun 8, 2013 21:55 |
|
I didn't know, because I didn't see what the inside of the if statement did.
|
# ? Jun 8, 2013 22:12 |
|
Suspicious Dish posted:I didn't know, because I didn't see what the inside of the if statement did. No problem, I was just a little too agressive at chopping away. Objective-C code:
|
# ? Jun 8, 2013 22:21 |
|
b0lt posted:I am somewhat considering using this in production, help someone stop me the horror is coming from inside the house It's just a form of custom allocation. Stack- or bulk- allocating objects that you plan to hand off to system routines has some obvious risks — you need to be by careful that the objects don't escape, including by ending up in the autorelease pool — but it can also be a serious optimization if allocation costs are killing you. Usually, though, a better answer is to figure out some way to make these objects not have to be Objective-C objects at all.
|
# ? Jun 8, 2013 22:22 |
|
Sinestro posted:No problem, I was just a little too agressive at chopping away.
|
# ? Jun 9, 2013 08:59 |
|
Aleksei Vasiliev posted:the real horror is the placement of that comment I'm inclined to agree. That's not where that goes
|
# ? Jun 10, 2013 11:37 |
|
My job literally just called me posted:"Hey 2banks what's up?" I don't even know what to say. I am not trolling. I am serious. I was just told to do this.
|
# ? Jun 10, 2013 23:17 |
|
2banks1swap.avi posted:I don't even know what to say. I don't understand. They told you to take the output of a process, and replace the input to that process with the output?
|
# ? Jun 10, 2013 23:49 |
|
Yeap. I don't either. Why the temp file can't be used (why bother making it just to copy the contents of it over the original file???) is lost to me. Is this normal and I'm just being an idiot ?
|
# ? Jun 11, 2013 00:27 |
|
I love corporate open-source dumps.code:
|
# ? Jun 11, 2013 01:19 |
|
I may not be understanding what you're saying, but programs that are supposed to modify a file often work by writing to a temporary file and then renaming that temporary to the original rather than just overwriting the original file directly. This updates the file atomically; otherwise, processes which are racing with the modifying program can see an incompletely-written file. Really, the only reason not to do this is if the file is so big that making two copies is a performance issue, or if you're totally certain for some reason that nobody will access that file while you're writing to it.
|
# ? Jun 11, 2013 01:31 |
|
I must be extremely risk-averse; I'd think you should keep the original file and just use the temp file, in case something went wrong. I stand corrected.
|
# ? Jun 11, 2013 01:40 |
|
The usual PHP horror:code:
code:
I understand why it returns what it does, but its still completely stupid. Innocent Bystander fucked around with this message at 04:35 on Jun 11, 2013 |
# ? Jun 11, 2013 03:51 |
|
edit no it isn't.
evensevenone fucked around with this message at 04:39 on Jun 11, 2013 |
# ? Jun 11, 2013 04:26 |
|
Haven't worked with PHP in years, is the horror that the first comparison dynamically casts 0 to '0' which persists and then fails the second comparison so the return value is 'default'? More importantly, is my ignorance bliss (in this case)?
|
# ? Jun 11, 2013 04:33 |
|
It absolutely is bliss! Whenever you try to compare a string to a number in PHP, PHP tries to convert the string to a number, and if the string cannot be cast to a number, or does not start with a number, it will assume you want 0 as its numerical value, and compare it that way. So in the switch statement, it attempts to compare 'k' to 0, so the 'k' gets cast to a number, which will be 0, so that case is fulfilled and the above example prints 'k'.
|
# ? Jun 11, 2013 04:38 |
|
Oh PHP. http://codepad.org/Ts3BDpjMPHP code:
|
# ? Jun 11, 2013 05:34 |
|
2banks1swap.avi posted:I must be extremely risk-averse; I'd think you should keep the original file and just use the temp file, in case something went wrong. The rename-the-temporary pattern avoids risk much more effectively than modifying the file in-place. Let's spell this out. The pattern here is:
Note that the standard pattern is to just do a rename, not a delete and rename. The latter is unnecessary (on POSIX systems) and introduces the possibility that a racing process could see a "partial write" (specifically, they could try to open the file and have it fail). If you need to protect against concurrent readers, this is just how you have to do it. On the other hand, not replacing the file has the merit that all the metadata associated with the original file is automatically preserved.
|
# ? Jun 11, 2013 08:25 |
|
Oh gently caress PHP, gently caress it hard. Is there a saner language that compiles to PHP, like CoffeScript compiles to Javascript? This poo poo is un-loving-believable
|
# ? Jun 11, 2013 08:37 |
|
hackbunny posted:Oh gently caress PHP, gently caress it hard. Is there a saner language that compiles to PHP, like CoffeScript compiles to Javascript? This poo poo is un-loving-believable Why the gently caress would you want something that compiles to PHP? Dart et al. only exist because javascript is the only thing that you can use on a browser.
|
# ? Jun 11, 2013 10:09 |
|
hackbunny posted:Oh gently caress PHP, gently caress it hard. Is there a saner language that compiles to PHP, like CoffeScript compiles to Javascript? This poo poo is un-loving-believable there are some strange, unfinished languages which purport to do this but i'd suggest you stay away from them. which version of PHP are you using? the pain you shall endure is inversely proportional to the version number though it will be great regardless
|
# ? Jun 11, 2013 10:14 |
|
hackbunny posted:Oh gently caress PHP, gently caress it hard. Is there a saner language that compiles to PHP, like CoffeScript compiles to Javascript? This poo poo is un-loving-believable XHP. Or learn not to do anything that might do implicit casting without thinking it over, stockholm syndrome style. PHP is a really good platform, though.
|
# ? Jun 11, 2013 10:31 |
|
Old-rear end PHP (like, code compatible with php4 or something) is an amazing platform, because it will run on even the most cheap and lovely of shared hosts. Modern php is far worse because the language is still terrible (just less so), and anywhere that will let you run it will also usually let you run something far better.
|
# ? Jun 11, 2013 12:11 |
|
hackbunny posted:Oh gently caress PHP, gently caress it hard. Is there a saner language that compiles to PHP, like CoffeScript compiles to Javascript? This poo poo is un-loving-believable http://www.joelonsoftware.com/articles/FogBugzIII.html
|
# ? Jun 11, 2013 12:48 |
|
The fact that Joel Onsoftware actually makes money with his poo poo and is even regarded as some kind of software icon amazes me to no end.
|
# ? Jun 11, 2013 13:33 |
|
quote:In Apps Hungarian you still have the prefixes, but they are supposed to add semantic information, not merely repeat the type of a variable. So for example when you have a buffer size, the variable should be named "cb", which means "count of bytes". Whenever you're writing C++ code that needs to deal with all kinds of strings, it's really nice to be able to look at the variable name, and if it's a psz, you know, oh, look, it's a pointer to a null-terminated string, but no memory is allocated! Or if it starts with rgch, you know it's an array of characters, with memory allocated, or rgwch, you know it's an array of Unicode (wide) chars, or if it starts with ix you know it's an index to something (or a primary key in SQL), etc. etc. This is loving terrible? Why yes remembering that if something starts with rgwch means an array of unicode wide characters IS something that's in my mind on a day to day basis, thanks!
|
# ? Jun 11, 2013 13:42 |
|
|
# ? May 17, 2024 13:31 |
|
I want to punch this page in the ear and you too for suggesting it. We get it Joel, you're an IT entrepreneur who was the youngest PM at Microsoft and held his own against Bill loving Gates, jesus christ stop fellating yourself for two seconds. And I used to admire the guy and follow his blog religiously I even remember this particular entry and used to remember it fondly Thanks for making me realize what kind of idiot I was, I guess?
|
# ? Jun 11, 2013 13:51 |